WatchDirectory home page
WatchDirectory Startseite (Deutsche Version)
Site WatchDirectory (Français)
  Welcome, Guest. Please Login or Register
YaBB - Yet another Bulletin Board
   
  HomeHelpSearchLoginRegister  
 
Page Index Toggle Pages: 1
Need of extended Script @ file-copy (Read 5088 times)
rkelly_2
YaBB Newbies
*
Offline



Posts: 8
Need of extended Script @ file-copy
Apr 1st, 2008 at 3:37pm
 
Hi Support,

i need the following sequence in the script:

Check folder for new pdf files
Run some other commands to manipulate the actual file
copy it to a new location with a new name with the actual date
run some other commands, like
echo The file %WD_FILE% is in progress... >> c:\temp\logs\wd_protocoll.log

What i´ve done is the following:

Create n new   automatic copy  task
Use dynamic naming for the target fiel:
C:\tmp\Aktuell{year}{monthname}{hour24}_{filetitle}
Remove the file after successfil copy
Only @ pdf files
Fast monitoring method

But i need to run some other cmd commands before/after the copy of the file.
Can i create a wd.bat file in the task directory, in which i can set my commands?

Thanks

André
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2238
The Netherlands
Re: Need of extended Script @ file-copy
Reply #1 - Apr 2nd, 2008 at 8:25am
 
Hello André,

The "wd.bat" trick only works for tasks based on the "run a .bat file" plugin. sorry. A future version will allow you to "combine" tasks in a way you describe.

Currently, you would need to do it with a bat script, something like this:
Code:
echo The file %WD_FILE% is in progress... >> c:\temp\logs\wd_protocoll.log
rem .. do some commands on the actual "%WD_FILE%"
rem make sure the target directory exists
SET YEAR=%WD_DATE:~0,4%
SET MONTH=%WD_DATE:~4,2%
SET DAY=%WD_DATE:~6,2%
SET HH=%WD_TIME:~0,2%
MD "C:\tmp\Aktuell%YEAR%%MONTH%%DAY%%HH%"
rem copy the file
COPY "%WD_FILE%" "C:\tmp\Aktuell%YEAR%%MONTH%%DAY%%HH%"
if %ERRORLEVEL% EQU 0 (
   DEL "%WD_FILE%"
)
 


Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
rkelly_2
YaBB Newbies
*
Offline



Posts: 8
Re: Need of extended Script @ file-copy
Reply #2 - Apr 2nd, 2008 at 9:20am
 
Hi Gert,

thanks for your response and help.
This solution is OK; I did not know that I can use the variables from WD in my batch file.

Bye

André
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2238
The Netherlands
Re: Need of extended Script @ file-copy
Reply #3 - Apr 2nd, 2008 at 10:43am
 
There are a lot more variables you can use, they are described here (English):
http://www.watchdirectory.net/wdhelp/plugins/wdopAutoRunBatEnv.html
and here (German):
http://de.watchdirectory.net/wdhelp/plugins/wdopAutoRunBatEnv_deu.html

By the way, if you want to "sharpen" your batch file skils, I can highly recommend this book:
"Windows NT Shell Scripting"
by Tim Hill
isbn: 1-57870-047-7
http://www.amazon.com/Windows-NT-Shell-Scripting-Circle/dp/1578700477


Gert
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Page Index Toggle Pages: 1