83618: Use RoboCopy cmd/bat fiiles from within TI Pre/Post command task options

5 replies [Last post]
GroverH
GroverH's picture
Offline
Legend
Joined: 2009-08-15
Posts: 11298
Use RoboCopy cmd/bat files from within TI Pre/Post command task options

Most any of the RobCopy functions possible.

This example uses TI post command option to use Robocopy to copy Backups from one folder to another folder as duplicates, from within a "cmd" file.

------------------------------------------

1. MUST Open Notepad IN "Run as Administrator" mode.
START/All Programs/Accessories/
RIGHT CLICK on NOTEPAD and Select "Run as Administrator"

Paste text below into the elevated NotePad
Save pasted text with "cmd" extension such as
c:\pstools\new-robo-test.cmd

paste into elevated Notepad wrote:

@ECHO OFF
%SystemDrive%
cd\Windows\system32\

:: FYI-To copy source folder into target folder with Manual cleanup of target
:: FYI- or Add /MIR to command for target to mirror source.
::
RoboCopy D:\TEST-2-SOURCE D:\TEST-2-TARGET
@EXIT


Section 1:
Notepad must be opened via the elevated prompt before inputing data into Notepad.

Simple copy of one folder to another folder. Both contents the same.


Section 2:
Task Options/Advanced/ Pre/Post Command options


Don't type path. Use Browse function to enter path to cmd file.


Section 3:
Comparison of Source Folder to Target Folder. Target folder content copied from Source by RoboCopy.



Section 4:
email notification of a similar test--not same test as above.

1 Information 2/16/2015 11:09:54 AM Backup reserve copy attributes: format tib; need_reserve_backup_copy false;
2 Information 2/16/2015 11:09:54 AM Operation (1)Test-lexar-Feb14-1 started manually.
3 Information 2/16/2015 11:09:54 AM Operation description: Stage Description.
4 2/16/2015 11:09:54 AM AcronisLRPCConnect::BEGIN id=4,336
5 2/16/2015 11:09:54 AM AcronisLRPCConnect::BEGIN id=3,688
6 2/16/2015 11:09:54 AM Retreiving Fdisk ver1 disk set to Fdisk ver2c disk set...
7 2/16/2015 11:09:54 AM Fdisk2: Use Disk 1 host= 0 bus = 0 target = 0
8 2/16/2015 11:09:54 AM Fdisk2: Use Disk 2 host= 0 bus = 0 target = 0
9 2/16/2015 11:09:54 AM Refreshing Drivers...
10 2/16/2015 11:09:54 AM Enter to process disks in Mbr Driver (id = 9)
11 2/16/2015 11:09:54 AM Exit from process disks in Mbr Driver (id = 9)
12 2/16/2015 11:09:54 AM Enter to process disks in Gpt Driver (id = 10)
13 2/16/2015 11:09:54 AM Exit from process disks in Gpt Driver (id = 10)
14 2/16/2015 11:09:54 AM LDM: New ProcessDisks(rawLayer, headLayer)
15 2/16/2015 11:09:54 AM ProcessDisks: One more disk to check
16 2/16/2015 11:09:54 AM ProcessDisks: One more disk to check
17 2/16/2015 11:09:54 AM Mark All groups as Root Like Dgs
18 2/16/2015 11:09:54 AM ------ Volumes Objects ------
19 2/16/2015 11:09:54 AM LDM initialization complete
20 2/16/2015 11:09:54 AM Analyzing partition '0-0'...
21 2/16/2015 11:09:54 AM AcronisLRPCConnect::BEGIN id=5,376
22 2/16/2015 11:09:55 AM Analyzing partition '1-1'...
23 2/16/2015 11:09:55 AM Analyzing partition 'C:'...
24 2/16/2015 11:09:55 AM Analyzing partition '0-0'...
25 2/16/2015 11:09:55 AM Analyzing partition 'D:'...
26 Information 2/16/2015 11:09:55 AM Backup reserve copy attributes: format tib; need_reserve_backup_copy false;
27 2/16/2015 11:09:55 AM Error while opening configuration file .
28 2/16/2015 11:09:55 AM Error occurred while creating the file.
29 Information 2/16/2015 11:09:55 AM Operation: backup
30 Information 2/16/2015 11:09:55 AM Priority changed to Low.
31 2/16/2015 11:10:18 AM Locking partition C:...
32 Information 2/16/2015 11:10:30 AM Create Backup Archive From: C:\Users\Grover\My Documents\MyTextFiles\
To file: "(1)Test-lexar-Feb14-1_full_b2_s1_v1.tib" Compression: Normal Exclude: Files matching mask Match criterion: $Recycle.Bin, swapfile.sys, System Volume Information, *.tib, *.tib.metadata, *.~, *.tmp, C:\Users\Grover\AppData\Local\Temp, C:\Users\Compaq User\AppData\Local\Temp, C:\Users\Grover\AppData\Local\Microsoft\Windows\Temporary Internet Files, C:\Users\Compaq User\AppData\Local\Microsoft\Windows\Temporary Internet Files, C:\Users\Grover\AppData\Local\Google\Chrome\User Data, C:\Users\Grover\AppData\Local\Opera Software, C:\Users\Grover\AppData\Roaming\Opera\Opera, C:\Users\Grover\AppData\Local\Mozilla\Firefox\Profiles, C:\Users\Compaq User\AppData\Local\Google\Chrome\User Data, C:\Users\Compaq User\AppData\Local\Opera Software, C:\Users\Compaq User\AppData\Roaming\Opera\Opera
33 Warning 2/16/2015 11:10:31 AM Link target was not backed up.
34 Information 2/16/2015 11:10:31 AM Writing full version to file: (1)Test-lexar-Feb14-1_full_b2_s1_v1.tib
35 Information 2/16/2015 11:10:31 AM The following backups have been successfully created: "D:\test2-source\(1)Test-lexar-Feb14-1_full_b2_s1_v1.tib"
36 Information 2/16/2015 11:10:34 AM Consolidate Backup Archive Location: "D:\test2-source\(1)Test-lexar-Feb14-1_full_b2_s1_v1.tib" Destination: "D:\test2-source\(1)Test-lexar-Feb14-1_full_b2_s1_v1_DB8D88B7-EF16-4B62-A955-459BFF16DC28.tib"
37 Information 2/16/2015 11:10:34 AM Consolidate Backup Archive Location: "D:\test2-source\(1)Test-lexar-Feb14-1_full_b2_s1_v1.tib" Destination: "D:\test2-source\(1)Test-lexar-Feb14-1_full_b2_s1_v1_DB8D88B7-EF16-4B62-A955-459BFF16DC28.tib"
38 Information 2/16/2015 11:10:34 AM Deleting backup file with path D:\test2-source\(1)Test-lexar-Feb14-1_inc_b1_s2_v1.tib.
39 Information 2/16/2015 11:10:34 AM Deleting backup file with path D:\test2-source\(1)Test-lexar-Feb14-1_full_b1_s1_v1.tib.
40 True Image 2/16/2015 11:10:35 AM Child process has exited with code '1'.
41 Information 2/16/2015 11:10:35 AM Execution of user command succeeded: C:/PSTools/new2-robo-test.cmd
42 2/16/2015 11:10:35 AM ServerLRPC::_CloseConnection id=5,376
43 2/16/2015 11:10:35 AM ServerLRPC::_CloseConnection id=5,376
44 2/16/2015 11:10:35 AM ServerLRPC::_CloseConnection id=3,688
45 2/16/2015 11:10:35 AM ServerLRPC::_CloseConnection id=3,688
46 2/16/2015 11:10:35 AM ServerLRPC::_CloseConnection id=4,336
47 2/16/2015 11:10:35 AM ServerLRPC::_CloseConnection id=4,336
48 Information 2/16/2015 11:10:35 AM Operation has succeeded.



By adding other Robocopy commands to the command line of the bat/cmd file,
other file actions can be accomplished.

AttachmentSize
robo-1.jpg9.25 KB
robo-2.jpg26.49 KB
robo-3.jpg54.15 KB
__________________

Grovers status = Inactive    1. Grover's New Revised Guides    4.  2014 Cleanup    2015 Cleanup    5. Attachments/How   7. TI 2015 FAQ.
2. Create BKU Tasks >   2011_2012_2013    2A. Using 2014    6.  Help  2016  2015 2014  2013       8.  Stop Scan for Backups   8A.  ATIH Video's
3.  Create new disks-Guides.    9.  Register/Downloads     10.  Mustang's New Guides   11.  Les Seiler's Backup Video

mgrobins
Offline
Forum Member
Joined: 2016-03-03
Posts: 52

Quick explanation if possible please.

 

Using Robocopy in the "post" command section will enable the copy destination to be "synced" with the originating directory?

THe reason I ask this is that the "reserve copy" facility is useless - it's not a copy and it's also just a new full backup.

One workaround is 2 sdequential backup tasks.

Your suggestion of using Robocopy seems more efficient though to produce a "post command" that would do what "reserve copy" should. I.e. a direct copy of the backup scheme including managing deletion of versions based on the backup structure.

Have I understood this correctly?

GroverH
GroverH's picture
Offline
Legend
Joined: 2009-08-15
Posts: 11298

mgrobins,

It is a copy process only and will do nothing about managing anything.

__________________

Grovers status = Inactive    1. Grover's New Revised Guides    4.  2014 Cleanup    2015 Cleanup    5. Attachments/How   7. TI 2015 FAQ.
2. Create BKU Tasks >   2011_2012_2013    2A. Using 2014    6.  Help  2016  2015 2014  2013       8.  Stop Scan for Backups   8A.  ATIH Video's
3.  Create new disks-Guides.    9.  Register/Downloads     10.  Mustang's New Guides   11.  Les Seiler's Backup Video

mgrobins
Offline
Forum Member
Joined: 2016-03-03
Posts: 52

Thanks :).  I think my query may be a bit OT given what I've worked out from your posting (sorry :)).

I thought Robocopy could be used to effectively sync two directories (but was initialy uncertain if it can "clean up" the target directory). As I understand it the /MIR option achieve this?

http://improve.dk/simple-file-synchronization-using-robocopy/

http://windowsitpro.com/windows-server/robocopy-over-network

These helped me develop a reliable way to ensure copies proceed but I don't see a way to have Robocopy open a network connection (eg login /password) for the destination. Is that possible or would it require something like the "net" command to open the connection and close it after?

 

 

Bobbo_3C0X1
Bobbo_3C0X1's picture
Offline
Acronis MVP Volunteer
MVP
Joined: 2013-02-27
Posts: 5715

As far as I can tell, Robocopy has not built in authentication options.  Netuse seems to be the best option.  

https://klyavlin.wordpress.com/2012/09/19/robocopy-network-usernamepassw...

Alternatively, pstools (psexec) may work for you as well.  It can be scripted to connect to remote shares, but unfortunately, username and password are plaintext, but if your network is secure, should probably be OK.

https://technet.microsoft.com/en-us/sysinternals/pstools.aspx

Products: True Image, Snap Deploy
System: Motherboard: GA-Z170X-Gaming 3 / CPU: i5 6600K (OC 4.3Ghz) / Memory: 16GB Corsair Vengeance DDR4 (OC 3000 Mhz) / NVMEs: Samsung 950PRO, MyDigital BPX / SSDs: OCZ Vertex 4, PNY XLR8 / HDs: WD Black / OS: Win 10 Pro x64 / NAS: WD MyCloud 4Tb
sim
Offline
Beginner
Joined: 2016-06-16
Posts: 20

Hi mgrobins

In fact robocopy has some very useful features besides the simple copy example posted here. To sync the source and destination dirs you use the /MIR parameter. I use rc with /MIR to keep a copy of the ati files on a NAS.

The reserve copy feature is a bandwidth hog, as it transfers a full copy each time. I have found robocopy to have a light touch with regards to cpu and ram.

Thanks for the very useful original post, groverh.