Read on full site | Join TechSpot! (it's free) | Bookmark / Share this



Batch file to synchronize folders over a network

poertner_1274
05-17-2005, 01:16 PM
Right now I've got a batch file to backup from My Documents to a networked drive at work. But I was wondering if there was a way to do this, but check to see if a file has been deleted. I have gotten rid of some files in my documents and they are still on my network drive. If I don't delete them from both at the same time I forget which ones they are.
Anyway, I know this is possible with a 3rd party software, but I wanted to get it done throught his batch file if at all possible, since it is a work computer and I'm not supposed to install anything onto it :evil:

This is what I am currently using.

@echo off
:: variables
set drive=j:\
set backupcmd=xcopy /s /c /d /e /h /i /r /k /y

echo ### Backing up My Documents...
%backupcmd% "%USERPROFILE%\My Documents" "%drive%"

:: use below syntax to backup other directories...
:: %backupcmd% "...source directory..." "%drive%\...destination dir..."

echo Backup Complete!
@pause

RealBlackStuff
05-17-2005, 02:47 PM
You would not need that at all, if you would set the J-drive's %USERPROFILE%\My Documents as your default in your PC.
(unless your network is slooooowww, or not always available).

Check if your company has Ontrack's (or V-Com's now) Powerdesk (Explorer replacement) available, that has built-in folder synchronisation. Laplink can do the same.

Your current batchfile cannot do that, there are simply no switches for that in xcopy.

Ad
05-17-2005, 02:47 PM
  

j4m32
05-20-2005, 03:48 PM
hi,
i dont think xcopy supports network, though:
1. (if you can) program in VB then you can use the built in functons and make a full standalone app or even an invisible app....
2. (alternative) make it copy to a big data stick/hdd with all the backup stuff on it
3. you could setup mirroring im not entirly sure who or where youcan get the service it just exists....

j4m32,

andygibbs
05-20-2005, 05:23 PM
Maybe a program like this would do what you want:

http://sourceforge.net/projects/dirssync


Edit: sorry just realised you said you didn't want to use an app

poertner_1274
05-20-2005, 05:47 PM
Thanks for the suggestions, I don't think an open source program would be a problem. I'll give that a look, but I think I have figured out how I will do it. It's not efficient, but it works.

Liquidlen
05-20-2005, 06:05 PM
Poertner;
My Batch work is rusty ,but I do have a command line /Scipt manual .So I will look this up if you want me to.
In the meantime,If these files(the ones you want to delete) always have the same name or can sit in the same Directory( Therefore you can state them as a variable) You can parse for their existence, then Goto your Xcopy command
eg.
for iterator (initialization variable and a set of files to execute against) do (Command)
If I understand your needs correctly this should work.

patio
05-22-2005, 11:44 AM
SyncBack...

patio. :cool:

Post a reply, see related topics & more

Tip: Download Advanced SystemCare 3 Free - Clean, Repair, Protect & Optimize your PC.



 Top Technology News

TechSpot Blog: Disable Windows automatic check for solutions after a program crashes

Weekend Open Forum: Google Chrome OS and the future of cloud computing

Tech Tip of the Week: Unearth Region-Specific Windows 7 Themes

Weekend tech reading: How to run Chrome OS as a virtual machine

Sony: PlayStation 3 to be 3D-capable via firmware update

iSuppli: DDR3 to account for over half of DRAM shipments by Q2 2010

Facebook named third most popular video website behind YouTube and Hulu

Patriot introduces new PS-100 SSD series

More Tech News

  
 Software Downloads

Norton Virus Definitions 2003-07 November 20, 2009

AVG Anti-Virus Updates November 20, 2009

Norton Virus Definitions 2008-09 November 20, 2009

avast! Virus Definitions November 20, 2009

McAfee SuperDAT Update 5808

Kaspersky Anti-Virus Update November 20, 2009

Google SketchUp 7.1.6087

More Downloads



Copyright © 1998-2009 TechSpot.com. TechSpot is a registered trademark. All Rights Reserved.