Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dates as part of a file name

Status
Not open for further replies.

RF101

Technical User
May 17, 2006
33
US
Hello,

I am trying to zip up a file using a date as part of the filename.

My Script
The folder I am zipping is named by the date.
I would like to name the file Test_Date.

strfmt sZipDir "zip -r Test %02d%02d%02d^M" iYear iMonth iDay

I have been experimenting all morning but I have not found a workable solution yet.

I tried this but it does not work:

strfmt sZipDir "zip -r Test_%02d%02d%02d %02d%02d%02d^M" iYear iMonth iDay

It does not read the second date section.

Do I need to define my required name as a new string? If so, how would I pull it all together when I produce the Zip command?

TIA
 
In your last command line, you need to add another occurrence of iYear iMonth iDay since there are six format variables in the strfmt command but only three variables specified for them.

 
Excellent. That worked. Like you said, I just added another set of iYear iMonth iDay.

strfmt sZipDir "zip -r Test_%02d%02d%02d %02d%02d%02d^M" iYear iMonth iDay iYear iMonth iDay

Thanks for your quick response.

RF101
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top