COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 07-13-2007, 05:03 PM   #1
dplmartin
Human being with feelings
 
Join Date: Jul 2007
Posts: 2
Default Synchronising a laptop when on the network

Hi,

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

::CONFIG SECTION
::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



::SCRIPT SECTION
::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.
IF ERRORLEVEL 1 GOTO STOPSYNC
IF ERRORLEVEL 0 GOTO STARTSYNC

:STOPSYNC
::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.
GOTO END

:STARTSYNC
::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
GOTO END

:END
::clears the set variables and exits the batch file
FOR %%C IN (sync file list server ping) DO set %%C=
exit
****************BAT FILE ENDS**********************************
dplmartin is offline   Reply With Quote
Old 07-15-2007, 10:01 AM   #2
dplmartin
Human being with feelings
 
Join Date: Jul 2007
Posts: 2
Default Script Update - Choice

I've noticed that the batch file has incurred some formatting errors when pasted into the thread. So I'm attaching it to this message as a txt attachment. Just change the extension to .bat after you've downloaded it.

I've also noticed that PathSync consumes a lot of resources while it syncs huge numbers of files. Even though you're connected to the network, it may not be a convenient time to sync. So I have included a new part to the batch file.

After checking that the server exists, the script will prompt you with a y/n question to see if you want to continue. It will default to y after a user defined number of seconds.

If you are using WinXP, you will now need a copy of choice.exe in your \Windows\System32 directory. You can download the open source version from here:
http://winsupport.org/utilities/freedos-choice.html

One idea that I came up with (but I don't know enough to do) is to get the batch file to read the server name or ip address from the PSS file. That way, if you're synchronising to more than one computer, the batch file would check to make sure that each one was there.
Attached Files
File Type: txt sync.txt (2.3 KB, 629 views)
dplmartin is offline   Reply With Quote
Old 07-15-2007, 05:12 PM   #3
Andrew Cockburn
Human being with feelings
 
Andrew Cockburn's Avatar
 
Join Date: Jun 2007
Location: CT, USA
Posts: 97
Default

I do this with foldershare - and actually take it a step further- it allows me to collaborate with friends in different countries over the internet. My reaper directories are automatically updated when any changes are made either end. You could also us it for synching your laptop to your server if you want to run foldershare on both of them.
Andrew Cockburn is offline   Reply With Quote
Old 09-07-2007, 08:21 AM   #4
fvgeene
Human being with feelings
 
Join Date: Sep 2007
Posts: 1
Default Re: Synchronising a laptop when on the network

Hi Dplmartin,

Excelent, very usefull script, Thank you!

However, I think I might be a good idea to get the chance to close a couple of applications (and save the files) before synch-ing. I wonder if that could be automated?

Thanks again, Fernand


_____________________________________

I edited the script setting the value following the time-out to "n" and adding a prompt in the :STARTSYNC -area:

ECHO.Close programs and save files, THAN hit any key...
PAUSE


It isn't much, but it does the trick.
Attached Files
File Type: txt sync_2.txt (2.3 KB, 589 views)

Last edited by fvgeene; 09-07-2007 at 05:01 PM.
fvgeene is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:20 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.