need to find a way to change filenames that relect the filename and
the date modified. I have found numerous ways to get the current date
and time appended to the filename but nothing with date modified. I
have users that need to have this in the filename and I am in search of

some help in this matter. Example is a file named test.txt with a date

modified 1/31/2005. I would like the filename to be test
(1/31/2005).txt. Thanks in advance ...

RE: Filename with date modified appended to filename by ESP

ESP
Fri Nov 04 14:42:03 CST 2005


I think what you are looking for is:
"Date last saved: " & objDocument.DateLastSaved

Reference here
http://www.microsoft.com/technet/scriptcenter/scripts/storage/files/stfivb31.mspx


ESP




"Guido" wrote:

> need to find a way to change filenames that relect the filename and
> the date modified. I have found numerous ways to get the current date
> and time appended to the filename but nothing with date modified. I
> have users that need to have this in the filename and I am in search of
>
> some help in this matter. Example is a file named test.txt with a date
>
> modified 1/31/2005. I would like the filename to be test
> (1/31/2005).txt. Thanks in advance ...
>
>

Re: Filename with date modified appended to filename by McKirahan

McKirahan
Fri Nov 04 15:49:17 CST 2005

"Guido" <tom.veroni@sncorp.com> wrote in message
news:1131116278.781427.239020@z14g2000cwz.googlegroups.com...
> need to find a way to change filenames that relect the filename and
> the date modified. I have found numerous ways to get the current date
> and time appended to the filename but nothing with date modified. I
> have users that need to have this in the filename and I am in search of
>
> some help in this matter. Example is a file named test.txt with a date
>
> modified 1/31/2005. I would like the filename to be test
> (1/31/2005).txt. Thanks in advance ...
>

You cannot have a "/" in a filename.

Will this help? Watch for word-wrap.

'*
'* Rename file with DateLastModified
'* "test.txt" => "test(11-04-2005).txt"
'*
Option Explicit
'*
'* Declare Constants
'*
Const cVBS = "filesmod.vbs"
Const cFOL = "D:\Temp\"
'*
'* Declare Variables
'*
Dim strDAT
Dim intFIL
intFIL = 0
Dim strFIL
Dim intREN
Dim strREN
'*
'* Declare Objects
'*
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objGF1
Dim objGF2
'*
'* Rename Files in Folder
'*
If Not objFSO.FolderExists(cFOL) Then WScript.Quit
Set objGF1 = objFSO.GetFolder(cFOL)
Set objGF2 = objGF1.Files
For Each strFIL in objGF2
If InStr(strFIL.Name,").") = 0 Then
strDAT = FormatDateTime(strFIL.DateLastModified,2)
strDAT = Replace(strDAT,"/","-")
strREN = strFIL.Name
intREN = InStrRev(strFIL.Name,".")
strREN = Left(strREN,intREN-1) & "(" & strDAT & ")" &
Mid(strREN,intREN)
objFSO.MoveFile cFOL & strFIL.Name, cFOL & strREN
intFIL = intFIL + 1
End If
Next
'*
'* Destroy Objects
'*
Set objGF2 = Nothing
Set objGF1 = Nothing
Set objFSO = Nothing
'*
'* Results
'*
MsgBox intFIL & " files were renamed in " & vbCrLf &
cFOL,vbInformation,cVBS



Re: Filename with date modified appended to filename by Dr

Dr
Sat Nov 05 15:16:43 CST 2005

JRS: In article <1131116278.781427.239020@z14g2000cwz.googlegroups.com>
, dated Fri, 4 Nov 2005 06:57:58, seen in news:microsoft.public.scriptin
g.vbscript, Guido <tom.veroni@sncorp.com> posted :
> need to find a way to change filenames that relect the filename and
>the date modified. I have found numerous ways to get the current date
>and time appended to the filename but nothing with date modified. I
>have users that need to have this in the filename and I am in search of
>
>some help in this matter. Example is a file named test.txt with a date
>
>modified 1/31/2005. I would like the filename to be test
>(1/31/2005).txt. Thanks in advance ...

It is much better to use fixed-width strings for such purposes, and ones
with fields in a logical order. Eschew FFF; follow ISO 8601 and use
YYYY-MM-DD or YYYYMMDD. You don't *have* do disregard a FIPS.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.

Re: Filename with date modified appended to filename by Guido

Guido
Mon Nov 07 18:45:44 CST 2005

that works for me ... thanks