Prev: SOLVED Script to Run System Backup in Vista
Next: OCR in browser using MODI in VBscript - Any thoughts appreciated
From: Marc M on 15 Feb 2010 11:19 Hello, I need a script that can rename file extensions for files in a specific folder if they are older than 36 hours. Any help with this is greatly appreciated! -Marc
From: Pegasus [MVP] on 15 Feb 2010 16:43 "Marc M" <marc.manfredi(a)gmail.com> said this in news item news:db14ca4e-d70e-443c-956d-3e6fb7542431(a)k5g2000pra.googlegroups.com... > Hello, > > I need a script that can rename file extensions for files in a > specific folder if they are older than 36 hours. > > Any help with this is greatly appreciated! > > -Marc Have a look at the DateDiff function. It lets you determine timestamp differences in seconds, minutes, hours etc. etc. You will find full details in the downloadable helpfile script56.chm.
From: Marc M on 16 Feb 2010 11:28 On Feb 15, 4:43 pm, "Pegasus [MVP]" <n...(a)microsoft.com> wrote: > "Marc M" <marc.manfr...(a)gmail.com> said this in news itemnews:db14ca4e-d70e-443c-956d-3e6fb7542431(a)k5g2000pra.googlegroups.com... > > > Hello, > > > I need a script that can rename file extensions for files in a > > specific folder if they are older than 36 hours. > > > Any help with this is greatly appreciated! > > > -Marc > > Have a look at the DateDiff function. It lets you determine timestamp > differences in seconds, minutes, hours etc. etc. You will find full details > in the downloadable helpfile script56.chm. Pegasus, thanks for the reply. I looked up the DateDiff function and it seems to be a way to compared between two fixed days/dates. I will create a scheduled task to run everyday and the script needs to look at the files in a particular folder and rename then if they are older than 36 hours. I didn't see a way to do this with the DateDiff function. Did I miss something? Thanks for your assistance. -Marc
From: Marc M on 16 Feb 2010 11:37 On Feb 16, 11:28 am, Marc M <marc.manfr...(a)gmail.com> wrote: > On Feb 15, 4:43 pm, "Pegasus [MVP]" <n...(a)microsoft.com> wrote: > > > "Marc M" <marc.manfr...(a)gmail.com> said this in news itemnews:db14ca4e-d70e-443c-956d-3e6fb7542431(a)k5g2000pra.googlegroups.com... > > > > Hello, > > > > I need a script that can rename file extensions for files in a > > > specific folder if they are older than 36 hours. > > > > Any help with this is greatly appreciated! > > > > -Marc > > > Have a look at the DateDiff function. It lets you determine timestamp > > differences in seconds, minutes, hours etc. etc. You will find full details > > in the downloadable helpfile script56.chm. > > Pegasus, thanks for the reply. I looked up the DateDiff function and > it seems to be a way to compared between two fixed days/dates. I will > create a scheduled task to run everyday and the script needs to look > at the files in a particular folder and rename then if they are older > than 36 hours. I didn't see a way to do this with the DateDiff > function. Did I miss something? Thanks for your assistance. > > -Marc I have this so far- strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root \cimv2") Set FileList = objWMIService.ExecQuery _ ("ASSOCIATORS OF {Win32_Directory.Name='c:\stdf_tmp'} Where " _ & "ResultClass = CIM_DataFile") For Each objFile In FileList If objFile.Extension = "stdf_tmp" Then strNewName = objFile.Drive & objFile.Path & _ objFile.FileName & "." & "stdf" errResult = objFile.Rename(strNewName) Wscript.Echo errResult End If Next
From: Pegasus [MVP] on 17 Feb 2010 01:39 "Marc M" <marc.manfredi(a)gmail.com> said this in news item news:df8138e7-bb30-4c73-afe6-003d6969bde7(a)g19g2000yqe.googlegroups.com... > On Feb 16, 9:34 pm, Marc M <marc.manfr...(a)gmail.com> wrote: > > The behavior that I'm trying to avoid is for the script to only rename > files with a stdf_tmp extension to stdf extension and not touch any > other files in the folder, basically ignore all other files. It seems > that the script will modify all files in the folder, not just the ones > with the stdf_tmp extension and it will rename files every time it > runs. You need to add an "if then" statement that tests your file name, e.g. like so: if {the 8 right-most characters of the file name are stdf_tmp} then if the file is older than 36 hours rename it end if end if
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: SOLVED Script to Run System Backup in Vista Next: OCR in browser using MODI in VBscript - Any thoughts appreciated |