Solved Script to compare and move folder and files

Microsoft Office professional 2010 softw...
August 12, 2014 at 19:07:00
Specs: Windows 2008, 8G

Go this script to compare 2 folder from different directories and if it matches the folder name it will move all sub-folder and files over. It works if I have letters and dot in the folder name. But if there is a space between the name of the folder it doesn't work.

Can someone please help to modify the script please. Much appreciated.

@echo off
if exist test del test
for /f "tokens=4,5 delims=\" %%a in ('dir /b /s /ad d:\users\children') do if not "%%b" == "" (
for /f "tokens=4,5 delims=\" %%m in ('dir /b /s /ad d:\users\classes') do if not "%%n" == "" (
if /i %%b equ %%n (
>>test echo d:\users\classes\%%m\%%n will be copied to: d:\users\children\%%a\%%b. All subdirectories incl.
>>test robocopy /MOV /S /R:1 d:\users\classes\%%m\%%n d:\users\children\%%a\%%b

See More: Script to compare and move folder and files

Report •

August 12, 2014 at 19:45:34
✔ Best Answer
>>test robocopy /MOV /S /R:1 d:\users\classes\%%m\%%n d:\users\children\%%a\%%b

>>test robocopy /MOV /S /R:1 "d:\users\classes\%%m\%%n" "d:\users\children\%%a\%%b"


Report •

August 12, 2014 at 21:41:07
Thanks a lot, it works with . and spaces now.

Report •
Related Solutions

Ask Question