Copy contents of folder to another folder.

April 20, 2011 at 09:01:38
Specs: Windows 7
The folder (Movies/NewRips) contains .mp4 files ,for example, Forest Gump.mp4). First, I would like to take the name of the file and create a folder Forest Gump. So now the (Movies/NewRips) directory doesnt contain any files now it contains folders (Movies/NewRips/Forest Gump), So once the folders are all created I would like to copy the contents of (Movies/NewRips) that will likely have multiple movies to my network share (Z:Movies). Please help. I would like to create a .bat that runs nightly to do this.

See More: Copy contents of folder to another folder.

Report •

#1
April 21, 2011 at 10:18:23
set MovieDir="c:\Movies\NewRips"
for /f "tokens=*" %%a in ('dir %MovieDir%\*.mp4 /b') do (
  md %MovieDir%\%%~na
  copy %%a %MovieDir%\%%~na
)


Note this is untested.


Report •

#2
April 21, 2011 at 12:34:43
Thanks for your help. The response I go was "%%a was unexpected at this time" . Not sure how to fix this.

Report •
Related Solutions


Ask Question