Posted On March 28, 2019

Batch File to Copy Files Containing Agents’ Names

kimconnect 0 comments
blog.KimConnect.com >> Codes >> Batch File to Copy Files Containing Agents’ Names
:: Set variables using system time and date
popd
Set today=%Date:~4,2%_%Date:~7,2%_%Date:~10,4%
IF “%today:~0,1%”==”0” ( SET today=%Date:~5,1%_%Date:~7,2%_%Date:~10,4%
IF “%today:~3,1%”==”0” ( SET today=%Date:~5,1%_%Date:~8,1%_%Date:~10,4%
)
)
echo %today%
pause
IF “%today:~2,1%”==”0” ( SET today=%Date:~4,2%_%Date:~8,1%_%Date:~10,4%
IF “%today:~0,1%”==”0” ( SET today=%Date:~5,1%_%Date:~8,1%_%Date:~10,4%
)
)
echo %today%
pause
:: Set P: to direct to the directory with the Agent files
net use P: \\FILESERVER01\Users\Recordings /persistent:yes /user:FILESERVER01\sysadmin {PASSWORD}
IF NOT EXIST P:\ THEN GOTO END
md “P:\person1\%today%”
md “P:\person2\%today%”
md “P:\person3\%today%”
pause
popd
:: Set directory to the folder where all the recordings are
pushd C:\Inetpub\ftproot\recordings\New Leads Campaign\%today%
:: Loop through each folder and it’s subfolders and do…
For /r %%G in (.) do (
pushd %%G
:: If there’s a file containing the word “Agent”, copy it to the folder “Trainee”
copy /y “*Agent*” “P:\Trainee\%today%”
:: If there’s a file containing the Agent’s name (fname letter + full lname), copy it to their folder
copy /y “*person1*” “P:\acyr\%today%”
copy /y “*person2*” “P:\gladalardo\%today%”
copy /y “*person3*” “P:\jcullen\%today%” )
popd
pushd C:\Inetpub\ftproot\recordings\Campaign1\%today%
For /r %%G in (.) do (
copy /y “*person4*” “P:\person4\%today%”
)
popd
pushd C:\Inetpub\ftproot\recordings\campaign2\%today%
For /r %%G in (.) do (
copy /y “*person5*” “P:\person5\%today%”
)
popd
:: Set directory to the folder where all the recordings are
pushd C:\Inetpub\ftproot\recordings\Recapture Campaign\%today%
:: Loop through each folder and it’s subfolders and do…
For /r %%G in (.) do (
pushd %%G
:: If there’s a file containing the word “Agent”, copy it to the folder “Trainee”
copy /y “*Agent*” “P:\Trainee\%date”
:: If there’s a file containing the Agent’s name (fname letter + full lname), copy it to their folder
copy /y “*person1*” “P:\person1\%today%”
copy /y “*person2*” “P:\person2\%today%”
copy /y “*person3*” “P:\person3\%today%”
)
net use P: /delete
:END

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Lightbox Javascript Contents

These JavaScript codes are open source and part of many applications, such as NextGen Gallery.…

Basic JavaScript: Understand String Immutability

// Setupvar myStr = "Jello World";// Only change code below this linemyStr[0] = "H"; //…

Gallery2 Random Highlight Mod

There's a SQL technical limitation where one may not update a table based on its…
Other project: DragonCoin.com