Code: Select all
@echo off
set sourceFolder=%~dp0
SET destinationFolder=%sourceFolder:~0,-9%
echo %sourceFolder%
echo %destinationFolder%
robocopy %sourceFolder% %destinationFolder% /xf desarquivador.bat /mov
Hello all,
I've made this code to move all files from some directories to it's parent directory.
All directories are similar, example:
E:\ftp\SLSBRTLM\Archive
E:\ftp\SLSTSOFI\Archive
E:\ftp\SLCNASLC\Archive
E:\ftp\SLSPGLRE\Archive
E:\ftp\SLSTRLC1\Archive
What I need is this to be done from a .txt file where I have all the directories where I want this script to run. I tried to do it but seems that I made some errors, can you assist me?
Code: Select all
@echo off
set file=C:\file.txt
for /f "delims=" %%a in (%file%) do (
set sourceFolder=%%a
set destinationFolder=%sourceFolder:~0,-9%
echo %sourceFolder%
echo %destinationFolder%
robocopy %sourceFolder% %destinationFolder% /mov
)