Login | |
|
 |
RE: Add Date To End of Text File Name - 1/10/2006 5:54:56 PM
|
|
 |
|
| |
kirrilian
Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
|
i use this, MyDate = Replace(Date, "/", "-") OutputFile = "./filecheck_Summary-" & mydate & ".txt" thats quick and dirty, if you want to put it in a specific order, such as yyyymmdd it becomes more difficult
_____________________________
Have you searched here ? VBScript Fundamentals My Site
|
|
| |
|
|
|
 |
RE: Add Date To End of Text File Name - 1/11/2006 7:43:05 AM
|
|
 |
|
| |
Cybex
Posts: 412
Score: 0
Joined: 9/14/2005
From: Florida
Status: offline
|
How does that help? Last time I checked "/" was not an expectable character for file names. If you mean to use it in conjunction with something else please say so, otherwise we will be seeing posts asking why they are getting an error when trying to rename their file. Cybex
_____________________________
Common sense is not so common.
|
|
| |
|
|
|
 |
RE: Add Date To End of Text File Name - 1/11/2006 7:47:19 AM
|
|
 |
|
| |
kirrilian
Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
|
agreed, hence the replace (from / to -) in my first reply
_____________________________
Have you searched here ? VBScript Fundamentals My Site
|
|
| |
|
|
|
 |
RE: Add Date To End of Text File Name - 1/11/2006 7:52:50 AM
|
|
 |
|
| |
Cybex
Posts: 412
Score: 0
Joined: 9/14/2005
From: Florida
Status: offline
|
I saw that in yours Kirrilian. Cybex
_____________________________
Common sense is not so common.
|
|
| |
|
|
|
 |
RE: Add Date To End of Text File Name - 1/12/2006 2:52:01 AM
|
|
 |
|
| |
mbouchard
Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
|
Try something like the bolded section below. You will just need to change it to work in whichever example you decide to use. Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFolder("c:\nt\test") Set fc = f.Files 'Will format the date as an 8 digit number i.e. 112006 will become 01012006 theDate = Right(String(2,"0") & month(Now()),2) _ & Right(String(2,"0") & Day(Now()),2) _ & Year(Now()) For Each f1 in fc if right(lcase(f1.name),4) = ".txt" then theBaseName = fso.GetBaseName(f1.name) theExtension = fso.GetExtensionName(f1.Name) f1.Move(fso.GetParentFolderName(f1.path) & "\" & theBaseName & "_" & theDate & "." & theExtension) 'wscript.Echo fso.GetParentFolderName(f1.path) & "\" & theBaseName & "_" & theDate & "." & theExtension End If Next
< Message edited by mbouchard -- 1/12/2006 11:41:29 PM >
_____________________________
Mike For useful Scripting links see the Read Me First stickey! Always remember Search is your friend.
|
|
| |
|
|
|
 |
RE: Add Date To End of Text File Name - 1/12/2006 2:55:56 AM
|
|
 |
|
| |
kirrilian
Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
|
i think a code block interprets everything literally so you would have to put that part separate to bold it
_____________________________
Have you searched here ? VBScript Fundamentals My Site
|
|
| |
|
|
|
 |
RE: Add Date To End of Text File Name - 1/12/2006 11:40:32 PM
|
|
 |
|
| |
mbouchard
Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
|
quote:
ORIGINAL: kirrilian i think a code block interprets everything literally so you would have to put that part separate to bold it BAH, thanks. Note to self, preview preview preview.
_____________________________
Mike For useful Scripting links see the Read Me First stickey! Always remember Search is your friend.
|
|
| |
|
|
|
|
|