Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a client-side application which modifies a data file on a file share. Essentially every time the application runs I'd like to back up the data file to a backups folder on the share.

Unfortunately the link between the client and the network share isn't always great. People connect over VPN and it can take a long time to perform a regular file copy.

I think the standard procedure for file copying between network shares is to copy it from the first network share to your local machine, and then from there to the destination share, even if the two shares are the same, right? Is there any way to initiate a file duplication to be carried out on the server itself?

It would have to be with standard commands available to SMB clients because I don't have any control over the file server.

share|improve this question
    
Any particular SMB client, or are you talking about plain vanilla Windows clients? –  squillman Aug 23 '11 at 21:24
    
@squillman No particular SMB client; I just want to know if it's possible at all without some special control of the server. –  Brian Gordon Aug 23 '11 at 22:35
    
It is certainly possible to do, but I have no idea how you actually initiate it. See section 3.2.4.11.2 Performing a Server-Side Data Copy and 4.6 FSCTL SRV COPYCHUNK of the SMB protocol spec –  Zoredache Aug 23 '11 at 23:11
    
Hm, thanks @Zoredache –  Brian Gordon Aug 24 '11 at 12:12

1 Answer 1

up vote 4 down vote accepted

Run a scheduled task that calls robocopy every so often. Look into the /MON:n or /MOT:n switches.

Repeated Copy Options
            /MON:n : MONitor source; run again when more than n changes seen.
            /MOT:m : MOnitor source; run again in m minutes Time, if changed.

The server will simply copy the file if there are changes to it whenever the scheduled task is run. However, if the configuration file is corrupted, you'll just be copying corrupted data. Lovely.

Better to perform a rename of the file after the robocopy and include a date in the filename. That way you have a history of files in case you find out something went sneakers up. I believe the following will rename your file by date: ren myfile.foo myfile%date:~4,2%-%date:~7,2%-%date:~10%.foo Robocopy returns 1 if it copies files with no problems. Zero if it doesn't copy anything.

I will leave the logic of the batch file as an exercise for the reader (mostly because I'm terrible at batch files).


EDIT

If you don't have access to the server, then you can simply run the Robocopy script in Scheduled Tasks on your PC to check the file share for modifications to the file and then copy it if changes are detected. With the unreliable connection between the client and server, look into the /Z switch for Robocopy.

/Z : Copy files in restartable mode (survive network glitch).

If you want to somehow to cause a backup to be run on the server's CPU itself with a trigger from a client PC... you'll need access to the server, and at that point the better option IMO would be to use the Robocopy concept above this edit.

share|improve this answer
    
I don't see anything around the internet about robocopy being able to do a server side data copy though :{ –  Brian Gordon Aug 24 '11 at 12:11
1  
@Brian I'm not following you. If you schedule the script on the server, it's server side. –  Wesley Aug 24 '11 at 18:28
    
I can't schedule anything on the server. This is an excellent answer, however. Thank you –  Brian Gordon Aug 24 '11 at 21:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.