HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Legacy
- >
- Windows Server 2003
- >
- Re: Robocopy HELP
Windows Server 2003
1832645
Members
3146
Online
110043
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2008 06:41 AM
09-17-2008 06:41 AM
Robocopy HELP
Hi,
May I know if Robocopy may do reverse copying as in destination to source instead?
Thanks,
wannabe
May I know if Robocopy may do reverse copying as in destination to source instead?
Thanks,
wannabe
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2008 11:06 AM
09-19-2008 11:06 AM
Re: Robocopy HELP
Yes. you can go both ways in looking for content that you want to sycronize across two shares (usually network and local).
This will probably paste in messy (sorry), but it's a script I use to sync a network to local documents share.
Jon
------------------------------
@echo off
rem ..: Generic robocopy syncronization script
rem ..:---------------------------------------------------------------------------------------------
rem ..: Notes: Uses CMD variables and robocopy to copy to and from a destination drive
rem ..: based on the file timestamp.
rem ..: Author: Jon Finley
rem ..: Date: 9-5-2007
rem ..: Updated: 11-16-2007 jf - Made more generic to be used as a template for future general use.
rem ..:---------------------------------------------------------------------------------------------
for /f "tokens=2,3,4 delims=/ " %%i in ('echo %date%') do (
set myday=%%j
set mymonth=%%i
set myyear=%%k)
set logdate=%myyear%-%mymonth%-%myday%
set logname=synclog_%logdate%.txt
rem ..: Check for the network drive
if not exist p:\. net use p: \\itfs1\clas\sols\users\%USERNAME% /persistent:yes
rem ..: Check for the sync folders
if not exist p:\synclogs\. mkdir p:\synclogs
rem if not exist p:\syncfolder\. mkdir p:\syncfolder
echo Copying changed files from the Source computer to the Destination drive
echo ============================================================================ >>p:\synclogs\%logname%
echo Copying changed files from the Source computer to the Destination drive >>p:\synclogs\%logname%
echo ============================================================================ >>p:\synclogs\%logname%
rem ..: copy from source to dest
robocopy "C:\Documents and Settings\%USERNAME%\My Documents" "P:\My Documents" /e /copy:dat /dcopy:t /xo /xx /r:2 /w:6 /v /ts /fp /log+:p:\synclogs\%logname% /tee
REM robocopy "D:\" "P:\D-Drive" /e /copy:dat /dcopy:t /xo /xx /r:2 /w:6 /v /ts /fp /log+:p:\synclogs\%logname% /tee
echo Copying changed files from the Destination drive back to the local computer
echo ============================================================================ >>p:\synclogs\%logname%
echo Copying changed files from the Destination drive back to the local computer >>p:\synclogs\%logname%
echo ============================================================================ >>p:\synclogs\%logname%
rem ..: copy from dest to source (for any newer files)
robocopy "P:\My Documents" "C:\Documents and Settings\%USERNAME%\My Documents" /e /copy:dat /dcopy:t /xo /xx /r:2 /w:6 /v /ts /fp /log+:p:\synclogs\%logname% /tee
REM robocopy "P:\D-Drive" "D:\" /e /copy:dat /dcopy:t /xo /xx /r:2 /w:6 /v /ts /fp /log+:p:\synclogs\%logname% /tee
rem ..:-----------------------------------------------------------
rem ..: end of syncronization script.
rem ..:-----------------------------------------------------------
This will probably paste in messy (sorry), but it's a script I use to sync a network to local documents share.
Jon
------------------------------
@echo off
rem ..: Generic robocopy syncronization script
rem ..:---------------------------------------------------------------------------------------------
rem ..: Notes: Uses CMD variables and robocopy to copy to and from a destination drive
rem ..: based on the file timestamp.
rem ..: Author: Jon Finley
rem ..: Date: 9-5-2007
rem ..: Updated: 11-16-2007 jf - Made more generic to be used as a template for future general use.
rem ..:---------------------------------------------------------------------------------------------
for /f "tokens=2,3,4 delims=/ " %%i in ('echo %date%') do (
set myday=%%j
set mymonth=%%i
set myyear=%%k)
set logdate=%myyear%-%mymonth%-%myday%
set logname=synclog_%logdate%.txt
rem ..: Check for the network drive
if not exist p:\. net use p: \\itfs1\clas\sols\users\%USERNAME% /persistent:yes
rem ..: Check for the sync folders
if not exist p:\synclogs\. mkdir p:\synclogs
rem if not exist p:\syncfolder\. mkdir p:\syncfolder
echo Copying changed files from the Source computer to the Destination drive
echo ============================================================================ >>p:\synclogs\%logname%
echo Copying changed files from the Source computer to the Destination drive >>p:\synclogs\%logname%
echo ============================================================================ >>p:\synclogs\%logname%
rem ..: copy from source to dest
robocopy "C:\Documents and Settings\%USERNAME%\My Documents" "P:\My Documents" /e /copy:dat /dcopy:t /xo /xx /r:2 /w:6 /v /ts /fp /log+:p:\synclogs\%logname% /tee
REM robocopy "D:\" "P:\D-Drive" /e /copy:dat /dcopy:t /xo /xx /r:2 /w:6 /v /ts /fp /log+:p:\synclogs\%logname% /tee
echo Copying changed files from the Destination drive back to the local computer
echo ============================================================================ >>p:\synclogs\%logname%
echo Copying changed files from the Destination drive back to the local computer >>p:\synclogs\%logname%
echo ============================================================================ >>p:\synclogs\%logname%
rem ..: copy from dest to source (for any newer files)
robocopy "P:\My Documents" "C:\Documents and Settings\%USERNAME%\My Documents" /e /copy:dat /dcopy:t /xo /xx /r:2 /w:6 /v /ts /fp /log+:p:\synclogs\%logname% /tee
REM robocopy "P:\D-Drive" "D:\" /e /copy:dat /dcopy:t /xo /xx /r:2 /w:6 /v /ts /fp /log+:p:\synclogs\%logname% /tee
rem ..:-----------------------------------------------------------
rem ..: end of syncronization script.
rem ..:-----------------------------------------------------------
"Do or do not. There is no try!" - Yoda
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2008 05:18 PM
09-21-2008 05:18 PM
Re: Robocopy HELP
Hi Jon,
Thank you for the great help here. I will test out the script and keep you update on the outcome.
Thanks,
wannabe
Thank you for the great help here. I will test out the script and keep you update on the outcome.
Thanks,
wannabe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2008 01:04 AM
09-22-2008 01:04 AM
Re: Robocopy HELP
Hi Jon,
Thanks for your time and reply.
I'm looking for a script where I will sync files straight from source to destination.
Do you think it's possible for Robocopy to do that? Where I'm able to sync the file in only one way, from destination to source? As destination is the prefer source of newer files to maintain to destination.
Thanks & regards,
Han
Thanks for your time and reply.
I'm looking for a script where I will sync files straight from source to destination.
Do you think it's possible for Robocopy to do that? Where I'm able to sync the file in only one way, from destination to source? As destination is the prefer source of newer files to maintain to destination.
Thanks & regards,
Han
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP