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
How to add date to filename (Read 3372 times)
MGarcia
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
How to add date to filename
Aug 25th, 2004 at 1:49am
 
I am trying to add, either by rename or copy, the date(mmddyyyy) to the filename once a static filename has been delivered to the directory Watchdirectory is monitoring.
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2225
The Netherlands
Re: How to add date to filename
Reply #1 - Aug 25th, 2004 at 2:18am
 
That shouldn't be to hard...

If you download our GdPUtil program (see http://www.gdps.dk/products/watchDir/GdPUtil.shtml) and use the following commands in your .bat file
Code:
C:\Bin\GdPUtil -datetime c:\temp\dt.bat
call c:\temp\dt.bat
del c:\temp\dt.bat
 


you will have several date (and time) related variables available in your .bat file. One of them is DT_DATE that contains the current date (yyyymmdd format).

So, inside your .bat file, you could rename the new file like this:

Code:
C:\Bin\GdPUtil -datetime c:\temp\dt.bat
call c:\temp\dt.bat
del c:\temp\dt.bat
REN "%WD_FILE%" "%WD_FILE_D%\%WD_FILE_B%.%DT_DATE%"
 


WD_FILE_D: the directory of the new file
WD_FILE_B: file name without extension

If you want it formatted like mmddyyyy, use %DT_MONTH%%DT_DAY%%DT_YEAR% instead.

In the above REN (rename) command, take care as it could 'fire' a new watchDirectory event. Perhaps it would be better to move or copy the file with the new extension to another directory.

Hope this helps,
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