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
Copy file to another dir and rename with date/time (Read 2771 times)
mikehoot2020
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Copy file to another dir and rename with date/time
Feb 14th, 2005 at 12:15pm
 
Hi

I need to monitor a directory and when a file arrives (every hour) I need to take a copy to another directory and rename it to include a date and time stamp.

If anyone could point me in the right direction I would be very grateful as I am new to this program.

Monitored Dir:   D:\INTERFACE

Filename (always the same)   JACPAS.DAT

Copy to Dir:   D:\INTERFACE\ARCHIVE

Rename file like:   20041402_1108_JACPAS.DAT

Thanks

Mike
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2239
The Netherlands
Re: Copy file to another dir and rename with date/
Reply #1 - Feb 14th, 2005 at 12:38pm
 
Hello Mike,

That should be easy enough. I suggest you use the wdautocopy.bat sample.

Find the line that reads
[code]COPY "%WD_FILE%" "%TARGETDIR%"[/code]
and change that to
[code]COPY "%WD_FILE%" "%TARGETDIR%\%WD_DATE%_%WD_TIME%_%WD_FILE_N%"[/code]

WD_DATE contains the date of the event (YYYYMMDD format)
WD_TIME has the time (HHMMSS)
WD_FILE_N contains just the name of the file (without directory), in your case JACPAS.DAT

Other %variables% you can use are explained here:
http://www.watchdirectory.net/watchDir/help/bat.html

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
 
mikehoot2020
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Re: Copy file to another dir and rename with date/
Reply #2 - Feb 16th, 2005 at 1:24pm
 
Perfect!

Works great and just what I was looking for.

I think you may have earned a sale on this script alone!

Thanks
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1