mirror folders

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
conjure
Pro Scripter
Posts: 63
Joined: Thu Jan 12, 2012 3:05 pm

mirror folders

Post by conjure » Thu Jun 02, 2016 6:54 pm

Hi i want to mirror 2 folders
Z:\1 and X:\1

i want any text file that appears on folder Z:\1 to be copied to X:\1
and whatever text gets deleted from Z:\1 to be deleted to X:\1 as well..

i tried with
GetFileList
CopyFile
DeleteFile

but i cant make it work.
any suggestions?

conjure
Pro Scripter
Posts: 63
Joined: Thu Jan 12, 2012 3:05 pm

Re: mirror folders

Post by conjure » Fri Jun 03, 2016 8:17 am

I made it

Code: Select all

label>start
///PLAYqueued
GetFileList>Z:\PLAYqueued\**,files
Separate>files,;,filenames
if>filenames_count=0
DeleteFile>X:\PLAYqueued\**
goto>End2
endif
let>k=0
Label>Loop
let>k=%k%+1
let>pa=\
Separate>filenames_%k%,pa,text
IfFileExists>X:\PLAYqueued\%text_3%
else
CopyFile>filenames_%k%,X:\PLAYqueued
endif
If>k=%filenames_count%,End,Loop
Label>End

GetFileList>X:\PLAYqueued\**,files
Separate>files,;,filenames
let>k=0
Label>Loop2
let>k=%k%+1
let>pa=\
Separate>filenames_%k%,pa,text
IfFileExists>Z:\PLAYqueued\%text_3%
else
DeleteFile>X:\PLAYqueued\%text_3%
endif
If>k=%filenames_count%,End2,Loop2
Label>End2
wait>1
goto>start

hagchr
Automation Wizard
Posts: 327
Joined: Mon Jul 05, 2010 7:53 am
Location: Stockholm, Sweden

Re: mirror folders

Post by hagchr » Fri Jun 03, 2016 11:27 am

Hi, on my machine, something like this would also work.

Code: Select all

Let>dir1=Z:\PLAYqueued
Let>dir2=X:\PLAYqueued
RunProgram>C:\Windows\System32\robocopy.exe %dir1% %dir2% /MIR

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Re: mirror folders

Post by CyberCitizen » Sun Jun 05, 2016 4:24 am

Yes I would suggest looking at RoboCopy as it allows you to copy settings etc.
FIREFIGHTER

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts