View Single Post
Old 07-13-2007, 05:03 PM   #1
Human being with feelings
Join Date: Jul 2007
Posts: 2
Default Synchronising a laptop when on the network


I have a few GBs of files on my laptop that I want to sync with the file server automatically when on the network. I looked at using XP's offline files but it tried to keep a copy of the files in a special folder that was not on the right drive and didn't have enough disk space. I tried moving the folder but couldn't find a way.

I did like the fact that Offline Files would check for the existence of a network connection before trying to synchronise. So when I found PathSync, I devised a little batch file to help me out.

The batch file is run from Windows Scheduler. It checks to see if the file server is responding. If it isn't there, it stops doing anything. If the server is there, it runs PathSync with the PSS files.

Feel free to comment on or use this batch file.

*************BAT FILE STARTS******************
@echo off

::set location of the PathSync executable
set sync="C:\Program Files\PathSync\PathSync.exe"

::set location of PathSync settings files
set file="C:\Program Files\PathSync\"

::configure which PSS settings files will be run by the batch file
::each filename must be separated by a space. A wildcard can to used so that *.pss will cause all pss files to be run.
::Example, set list=1.pss 2.pss 3.pss or set list=*.pss
set list=*.pss

::set the name of the server or IP address to ping
set server=YOURSERVER

::number of pings to try
set ping=2

::There's no need to change anything below this level

::clear errorlevel
cmd /c

ECHO.Verifying the existence of %server%
:ing the server with x number of pings and discard the text output
ping -n %ping% %server%>NUL

:ing has two error levels, 0 for success and 1 for failure
::errorlevel checks are equal to or greater than, so highest errorlevel number is checked first.

::confirms failure and goes to the end of the script
ECHO.%server% not found. You are either disconnected from the network or %server% does not reside on this network.

::runs all commands required after successful connection is determined.
ECHO.%server% is available.
ECHO.Starting Synchronisation Routines
::for commmand will run pathsync with the loadpss and autorun options for every pss file specified in the list variable
FOR %%P IN (%list%) DO %sync% -loadpss %file%%%P -systray -autorun

::clears the set variables and exits the batch file
FOR %%C IN (sync file list server ping) DO set %%C=
****************BAT FILE ENDS**********************************
dplmartin is offline   Reply With Quote