Steven
Tue Mar 07 19:43:56 CST 2006
Change;
sNewExt = "." & Day(Now) & Hour(Now) & Minute(Now)
To;
sDay = Day(Now): If Len(sDay) < 2 Then sDay = "0" & sDay
sNewExt = "." & sDay & Hour(Now) & Minute(Now)
:o)
--
Regards
Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk
Keeping it FREE!
"Monsignor JAV" <jonvillalva@gmail.com> wrote in message
news:1141774943.109656.131590@i39g2000cwa.googlegroups.com...
> Steve you have been a great help but I have one more question for you.
> Is there a way to get the leading zeros in the day-time format for the
> extension if they are less than ten? I think this was the one of the
> reasons the fella I spoke to told me to use WMI. Please help me this
> one last time. Thanks!
>
> Jon V
> Steven Burn wrote:
> > I've pre-saved a copy of the script in a .vbs file for you if it will be
> > easier
> >
> >
http://downloads.mysteryfcm.co.uk/scripts/vbsrenamefileext.vbs
> >
> > If you'd rather do it yourself, the script is below.
> >
> > '// START
> > '// vbsRenameFileExt.vbs
> > Option Explicit
> > WScript.Echo "Starting"
> > RenameFiles ".\" '// ./ is the directory containing this script
> > WScript.Echo "Finished"
> > Sub RenameFiles(sFolder)
> > Dim objFSO, colFiles, objFile, sNewExt
> > Set objFSO = CreateObject("Scripting.FileSystemObject")
> > Set colFiles = objFSO.GetFolder(sFolder).Files
> > For Each objFile In colFiles
> > sNewExt = "." & Day(Now) & Hour(Now) & Minute(Now)
> > objFSO.MoveFile objFile, Replace(objFile.Name, ".txt", sNewExt)
> > Next
> > End Sub
> > '// END
> >
> > --
> > Regards
> >
> > Steven Burn
> > Ur I.T. Mate Group
> > www.it-mate.co.uk
> >
> > Keeping it FREE!
> >
> > "Monsignor JAV" <jonvillalva@gmail.com> wrote in message
> > news:1140568845.867780.42580@o13g2000cwo.googlegroups.com...
> > > Thanks for sending me the link Steven. I was talking with someone
elses
> > > and they also suggested using file system object after I had already
> > > posted. Like I said I am a beginner at this and it was originally
> > > suggested that I use wmi because these scripts are going to be
> > > automated on a server for an access database we have been designing. I
> > > was under the impression that with a wmi script it would enforce a
> > > global policy regardless of what ever else was going on. Anyway. I
> > > looked at the link and this does not clearly explain how to format the
> > > extension with a dynamic "*.ddhh" after each new file is created. The
> > > files will be created every hour or two and have the extension of
> > > *.txt. I need to change these extensions before ftping them with a
file
> > > extension in the format
> > >
> > > test.format(Now(),"ddhh").
> > >
> > > Do you by chance now how to write the script for this. In advance
> > > thanks for your input or help.
> > >
>