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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File List

Status
Not open for further replies.

GRonken

Programmer
Oct 30, 2003
26
0
0
US
I want to to take a file with a date and time stamp attached to the file name, and rename it to file name and date. I won't know the name of the file because of the timestamp so I assume I need to have a wildcard of some type. Is their an easy way of doing this OR is it possible at all. The directory should have ONLY one file in it at a time and I can trap for that and send a message to have something done manuallyto correct the problem .. Thanks

IS:
\temp\charges_20031124083753.txt

WANT:
\temp\charges.txt
 
Something like this ?
Code:
old="\temp\charges_20031124083753.txt"
out=Left(old,Len(old)-19)&Right(old,4)
WScript.Echo old, vbCrLf, out
For the file retrieving and renaming you can use the FileSystemObject (GetFolder method, Files collection, ...)
Do a keyword search in this forum for fso.

Hope This Help
PH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top