Scripts Thread, Robocopy script to move old backups to archive share in Coding and Web Development; Don't flame me too hard guys as I am command line-phobic and I am new to this. Basically, I want ...
8th October 2010, 03:18 PM #1
- Rep Power
Robocopy script to move old backups to archive share
Don't flame me too hard guys as I am command line-phobic and I am new to this. Basically, I want to setup a test system before rolling out to production. I want to copy the folder structure of the backup area, and move any files contained there that are over 60 days old and are not in the folders and files I have specified. I also want to keep the file attributes regarding security and time stamps etc.
I have scheduled this test script and it ran, but didn't actually move anything. I would greatly appreciate help in finding out where I have gone wrong.
Basically, I have cannibalised various scripts I found on the internet to come out with what is below:
SET what_to_copy=/COPY:DAT /MOV /B /MIR
SET exclude_dirs=/XD "banks" "colin temp"
SET exclude_files=/XF /MINAGE:60 *.tmp "vssver.scc"
SET options=/R:1 /W:1 /LOG+:%log_fname% /NFL /NDL /E /XJ
%robo_path% %source_dir% %dest_dir% %what_to_copy% %options% %exclude_dirs% %exclude_files%
IDG Tech News
8th October 2010, 04:17 PM #2
- Rep Power
Good spot on the extra ".
I copied the rest of the first line without really knowing what it meant - i assumed % meant any (or the system) directory.
I changed it to
SET robo_path="\\server1\c$\RoboCopy.exe" but it still doesn't work :-(
8th October 2010, 08:24 PM #3
Here's a slightly different version of your script. Since I wasn't sure which operating system you are using I made the script look for RoboCopy.exe in the same folder as the batch file.
:: RoboCopy Settings
SET WHAT_TO_COPY=/COPY:DAT /MOV /B /MIR
SET EXCLUDE_DIRS=/XD "banks" "colin temp"
SET EXCLUDE_FILES=/XF /MINAGE:60 *.tmp "vssver.scc"
SET OPTIONS=/R:1 /W:1 /LOG+:%log_fname% /NFL /NDL /E /XJ
:: Start backup
Start "" /Wait "%SCRIPTDIR%\RoboCopy.exe" %SOURCE% %DESTINATION% %WHAT_TO_COPY% %OPTIONS% %EXCLUDE_DIRS% %EXCLUDE_FILES%
Thanks to Arthur from:
fat_techie_virgin (19th October 2010)
19th October 2010, 02:48 PM #4
- Rep Power
Thanks to both for your assistance. Unfortunately I still could not get it to work, so I used the free technet download Robocopy.gui to start from scratch and that was actually OK. I recommend any Robocopy newbies to check it out.
By harrimann in forum Scripts
Last Post: 5th January 2011, 12:41 PM
By thesthelensman in forum MIS Systems
Last Post: 13th April 2010, 03:16 PM
By RabbieBurns in forum Scripts
Last Post: 20th November 2009, 03:05 AM
By TheFopp in forum Windows
Last Post: 19th November 2008, 11:05 AM
By projector1 in forum Windows
Last Post: 1st February 2007, 09:42 AM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread