Help Creating Batch file to create subfolder and move data.

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
RandomPezzer
Posts: 2
Joined: 01 Sep 2014 11:28

Help Creating Batch file to create subfolder and move data.

#1 Post by RandomPezzer » 01 Sep 2014 11:37

Hi Guys,

I'm new to this stuff.

I've got a list of films in a Folder Called Movies.

What Need to do is create a Sub-Folder for each film then copy the correct film to there own Sub-Folder.

for example:

A.avi moves to folder called A
B.avi moves to folder called B
C.avi moves to folder called C

and so ...........

Is this possible and if it is can someone help me please.

Thanks

aGerman
Expert
Posts: 4744
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Help Creating Batch file to create subfolder and move da

#2 Post by aGerman » 01 Sep 2014 13:04

Create that Batch file in your "Movies" folder:

Code: Select all

@echo off &setlocal
for /f "delims=" %%i in ('dir /a-d /b *.avi') do (
  md "%%~ni"
  move "%%i" "%%~ni\"
)

Regards
aGerman

RandomPezzer
Posts: 2
Joined: 01 Sep 2014 11:28

Re: Help Creating Batch file to create subfolder and move da

#3 Post by RandomPezzer » 01 Sep 2014 14:09

Thanks So much works a treat.

Cheers

Post Reply