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

copy only a specific file corresponding to the day's date

Status
Not open for further replies.

moogeboo

MIS
Aug 7, 2003
28
US
hello,

i have a process which downlods 5 files at once every morning in the format of:

abc.010104.txt
abc.010204.txt
abc.010304.txt
abc.010404.txt
abc.010504.txt

the format is: abc.(date).txt
the only thing that changes on the files are the dates.

as you know, the download stamps these files with the same time and date, so i can't use that as an attribute.
i just want to create a script that would copy the file that corresponds to the specific day, every day, automatically. for example, today is the 9th, then the only file i would want to copy out of the 5 files would be the abc.010904.txt file. for tomorrow, the 10th, i would want to copy the abc.011004.txt file only.

does anyone have any idea how to approach doing this???

Thanks a lot...
 
Try something like this:
Code:
today=Right("0" & Month(Date),2) _
& Right("0" & Day(Date),2) _
& Right(Year(Date),2)
src="\path\to\abc." & today & ".txt"
dest="\path\to\destdir\"
Set fso=CreateObject("Scripting.FileSystemObject")
If fso.FileExists(src) Then
  fso.CopyFile src,dest ',True 
Else
  WScript.Echo src & " not found"
End If


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

Part and Inventory Search

Sponsor

Back
Top