Batch file is moving files individually and not folders.
Posted: 03 Aug 2018 10:56
Hi
I have the following script Ive tried to write and 90% there but it moving the files individually and not the subfolders.
Any Ideas?
I have the following script Ive tried to write and 90% there but it moving the files individually and not the subfolders.
Any Ideas?
Code: Select all
@echo off
set Source=C:\DOWNLOADS
set Target=C:\DOWNLOADS1
for /F %%a in ('dir /od /b "%Source%\btp*.*"') do set Folder=%%a
copy /y "%SourcE%\%Folder%" "%Target%"
set Source=C:\DOWNLOADS
set Target=C:\DOWNLOADS2
for /F %%a in ('dir /od /b "%Source%\chiltern*.*"') do set Folder=%%a
copy /y "%SourcE%\%Folder%" "%Target%"
del /q "C:\DOWNLOADS\*"
FOR /D %%p IN ("C:\DOWNLOADS\*.*") DO rmdir "%%p" /s /q
xcopy C:\DOWNLOADS2 C:\DOWNLOADS3 /E