Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Script to move only modified content to folder

Posted on 2014-01-20
Medium Priority
Last Modified: 2014-01-21
G'day guys,

This has probably been asked before, but I searched and couldn't find exactly what I was after.

Its a simple thing I'm sure but scripting is not my forte.

Basically I have a client who works away from her server, but comes back in house to that server every Friday of every week.

On the server there is a shared folder that contains all her work, which she has a mirror copy of stored locally on her laptop. Obviously she works on the local copy and then when she comes back on Friday she needs to copy all the modified data to the servers copy.

Now my question is would it be a good idea to use something like Bit Torrent Sync or Wuala to keep these in sync? Or is a script just as good?

The total folder size currently is 4GB, and it contains a lot of static unchanging files. I'm guessing that she only edits a fraction of those files around 100 MB per month maximum.

The other option is to use a simple script that she just runs each time she comes into the office.

Ideas are appreciated guys thanks in advance

Question by:sjswarts
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1

Expert Comment

ID: 39796241
What client OS are we talking about?
If you already have some backup solution in place that supports clients of the proper OS type, I recommend creating a new backup job specific for that client that takes incremental backups every so often.
We use bacula: http://www.bacula.org/en/
It is open source so theoretically supports any and all OS's but practically it's a day's work or two to
- install and setup a Linux (or any other Unix) server
- learn how to configure tape and disk backup media
- configure a windows client with arbitrary schedule

You can also start jobs manually so given sufficient privileges she can initiate the backup for her very own client at the time of her choice (i.e. before leaving workplace)

Author Comment

ID: 39796573
Thanks for the response. I have looked into Bacula awhile ago, but haven't set up anything for a long while now.

This is the system as it stands:

Server: \\*SERVER*\data\folder_to_sync
Client: C:\folder_to_sync

Now what I setup today was bittorrent sync which uses a P2P system. One install on the server, one install on the client.

Very easy software to use, plus its fully secured, the data stays locally and its great because it is free even for commercial.

But even though that is how I have got around the issue, would anyone know how to use an actual script? Or be able to point me in a direciton where I can learn off tutorials??

LVL 21

Expert Comment

ID: 39796843
Just a couple of suggestions on cautions you need to take.

1) remember that if you sync, you'll be syncing unwanted changes (deletions, virus infections, etc.) as well as the ones you want to be syncing.  You need a backup, not just a sync, so you can go back to a week or two ago if you don't realize for a few days that something bad happened.

2) Make sure that if there is *any* chance for the files in the office to be changed other than through your sync process, that you have some protection built in to prevent those wanted changes from being overwritten.
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.


Author Comment

ID: 39796921
Thank you for your post. You hit the main issues exactly.

The server does backups using Windows Server Backup every 1/2 day. So that gives us some grace.

As for the issue with people editting the same file, I don't know
LVL 21

Expert Comment

ID: 39797245
Robocopy has options for checking periodically to see if files have changed, and for copying only changed files.  You can create a batch file with the necessary command-line switches, and let it check periodically throughout the day.   Should be unobtrusive, and do what you need when the employee is in the office.
LVL 15

Expert Comment

ID: 39797881
I use Robocopy to perform copying, mirroring, synching. It can be easy up to complex.

An easy script, for example, is below at the bottom

This is a batch script that runs as a scheduled task on a server. It maps a folder as a network drive.  The folder is called "scanimg" on the laptop.  The robocopy copies only new or changed content to my server's d:\rximages\ folder.   /R:3 = retires 3x to copy a file and /W:5 is wait 5 seconds between retries. /LOG stores a log file of results.

I'm mapping the drive without credentials because my user launching the task exists on the laptop with the same password. Otherwise it would prompt which is bad for automation! You could always add /user:joesmith password_here to the net use statement if you didn't mind keeping that in the open.


net use u: \\laptop\scanimg
robocopy U:\ d:\RxImages\ /S /R:3 /W:5 /LOG:d:\mylog.txt
net use u: /d

I have other more complex examples if you want...what OS would the Robocopy run under? You can also have Robocopy completely mirror folder A on machine A to folder B on machine B....while just copying new/updated files (including mirroring deletes).

Author Comment

ID: 39799076
Thank you ZabagaR,

that is what I'm after.

The server OS is SBS 2011 and the client is Windows XP currently. The client is using a temporary laptop and will be replacing that with a Windows 7 in the next month.

I tried reading through the robocopy manual but I couldn't find the switch that only moved modified data. Obviously I am blind.

Does the switch /s do that because according to the Microsoft site it says:

/s - Copies subdirectories. Note that this option excludes empty directories.

Like you have mentioned

/r:# - amount of retries
/w:# - wait time for retries

On their website it doesn't mention copy only modified
LVL 21

Accepted Solution

SelfGovern earned 2000 total points
ID: 39799114
You want to check the Archive bit, which is done with the /a or /m flag.  I suggest /m, which will reset the archive bit (so that the file is not copied again unless it is changed again).

If you don't include the /s flag, you'll only copy files at the current directory, none of the subfolders.  the /s flag has nothing to do with whether files are changed, only with whether robocopy looks just *here*, or if it also looks to find matches deeper in the directory tree.

Author Comment

ID: 39799118
Ok fantastic, thankyou mate.

I was confused with the terminology used. But according to wiki ...

Archive: When set, it indicates that the hosting file has changed since the last backup operation. Windows' file system sets this attribute on any file that has changed. Backup software then has the duty of clearing it upon a successful backup.

So now I understand.

Thank you muchly this is what I was looking for.

Expert Comment

ID: 39799155
wow an excellent solution indeed. Reminds me of Occam's razor.

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Your data is at risk. Probably more today that at any other time in history. There are simply more people with more access to the Web with bad intentions.
This program is used to assist in finding and resolving common problems with wireless connections.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question