WatchDirectory Forum
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl
watchDirectory forums >> How to... >> multiple folders
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl?num=1098955232

Message started by fatihfx on Oct 28th, 2004 at 5:20pm

Title: multiple folders
Post by fatihfx on Oct 28th, 2004 at 5:20pm
i use multiple folder. i want , set my multiple folders then if main folder changed then all chenges set my multiple folders.

sample.
-------------------------------------
main folder (watching) : c:\A

other folder:

c:\B
c:\D
c:\E
d:\F
--------------------------------------

if i copied a file in c:\A folder then watchdirectory copy new file other directory (b,d,e,f)

Or DELETE
Or UPDATE
OR any


Title: Re: multiple folders
Post by Gert on Oct 28th, 2004 at 10:58pm
Hi,

The easiest way to do this is with 2 .bat files.
Copy the WDAutoCopy.bat from the samples directory to, for example, C:\Bin
Create a new .bat file (name it C:\Bin\CopyAll.bat), that has the following code:

Code (]
SET TARGETDIR=C:\B
Call C:\Bin\WDAutoCopy.bat
SET TARGETDIR=C:\D
Call C:\Bin\WDAutoCopy.bat
SET TARGETDIR=C:\E
Call C:\Bin\WDAutoCopy.bat
[/code):



You also need to change the WDAutoCopy.bat file, remove the line that reads:
[code]
SET TARGETDIR=C:\TARGET

and also the first few lines inside it (as instructed in the .bat file).
Let watchDirectory start the C:\Bin\CopyAll.bat file for all changes.

That should do the trick!

Gert

Title: Re: multiple folders
Post by fatihfx on Oct 29th, 2004 at 2:20pm
this method is not working.

untitled1.bat :

SET TARGETDIR=C:\Documents and Settings\Administrator\Desktop\test1\
Call C:\Documents and Settings\Administrator\Desktop\WDAutoCopy.bat
SET TARGETDIR=C:\Documents and Settings\Administrator\Desktop\test2\
Call C:\Documents and Settings\Administrator\Desktop\WDAutoCopy.bat
SET TARGETDIR=C:\Documents and Settings\Administrator\Desktop\test3\
Call C:\Documents and Settings\Administrator\Desktop\WDAutoCopy.bat


WDAutoCopy.bat :

GOTO EndRemarks

:EndRemarks

IF NOT "%WD_RELDIR%" == "" SET TARGETDIR=%TARGETDIR%\%WD_RELDIR%

GOTO %WD_REASON%

:DIRREN
:DIRNEW
MD "%TARGETDIR%\%WD_FILE_N%"
GOTO QUIT

:FILEREN
:FILENEW
:FILECHNG
COPY "%WD_FILE%" "%TARGETDIR%"
GOTO QUIT

:DIRDEL
GOTO QUIT

:FILEDEL
GOTO QUIT

:DIRCHNG

GOTO QUIT

:QUIT


Title: Re: multiple folders
Post by Gert on Oct 29th, 2004 at 10:30pm
Please remove the backslash (\) at the end of your SET statements, and place "quotes" around the .bat file name you call so it becomes:

[code]
SET TARGETDIR=C:\Documents and Settings\Administrator\Desktop\test1
Call "C:\Documents and Settings\Administrator\Desktop\WDAutoCopy.bat"
[/code]
I don't know WHY Microsoft decided to allow spaces inside filenames, they always cause trouble...

Gert

Title: Re: multiple folders
Post by fatihfx on Nov 1st, 2004 at 6:21pm
thanx. now working.

WatchDirectory Forum » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2017. All Rights Reserved.