Page 1 of 1

How to timestamp a file

Posted: Tue Apr 21, 2009 2:43 pm
by ds_is_fun
How do i timestamp a file in DS?
Thanks

Posted: Tue Apr 21, 2009 3:07 pm
by ray.wurlod
After-job subroutine ExecSH to mv the file to a new name that includes date. Search the forum for more details.

Posted: Tue Apr 21, 2009 7:27 pm
by dsuser_cai
After you create the file use the after job subroutine to rename/ move the file with a new file name.

Use the following command to rename with date or date and time

Example

file name: New.txt

mv New.txt New_`date '+%Y%m%d%`

this will rename the file with the date
-----------
If you want to add timestamp to the file then use this

mv New.txt New_`date '+%Y%m%d%H%M%S'`

Posted: Tue Apr 21, 2009 7:42 pm
by Kryt0n
If using a sequence to call your job, an alternative is to pass the date in as a parameter... (User Variable set to Date()). This way, if you ever do a "View Data" on the file, at least then the file will exist.

(And take away the panic of being told the file does not exist despite the fact you have just created it!)