![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Delete all .processed files First I am not a programmer. I have done a little scripting. Here is the problem: Ha a program that creates log files Audit1.log, audit2.log ect. in c:\logs .. Another program comes along and reads the file into its database and renames the file audit1.log.proccessed. I have tried to write a script that will delete any files with .processed but it will not work. I belive the problem is that it reads from left to right and sees the .log only. Any ideas? Thank you |
My System Specs![]() |
| | #2 (permalink) |
| | RE: Delete all .processed files Okay 20 minutes after this post a programmer stopped by. sub recurse( byref folders) Set regEx = New RegExp regEx.Pattern = "\.processed$" regEx.IgnoreCase = True set files = folders.files wscript.echo "" wscript.echo "Deleting Files under the Folder:" & folders.path wscript.echo "__________________________________________________________________________" for each file in files if regex.test(file.name) and file.datelastmodified < newdate then wscript.echo "Deleting " & folders.path & "\" & file.name & " last modified: " & file.datelastmodified on error resume next file.delete end if next It worked. "Stacey" wrote: Quote: > First I am not a programmer. I have done a little scripting. > > Here is the problem: > > > Ha a program that creates log files Audit1.log, audit2.log ect. in c:\logs > . Another program comes along and reads the file into its database and > renames the file audit1.log.proccessed. > > I have tried to write a script that will delete any files with .processed > but it will not work. I belive the problem is that it reads from left to > right and sees the .log only. > > Any ideas? > > Thank you |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Delete all .processed files Crikey! Perhaps if a real programmer had stopped by, they'd have suggested DEL /s *.processed from the command-prompt. But real programmers are becoming rare nowadays. "Stacey" <Stacey@xxxxxx> wrote in message news:315CED02-16C5-4ED8-BCD5-B4574A533E87@xxxxxx Quote: > Okay 20 minutes after this post a programmer stopped by. > > > sub recurse( byref folders) > > Set regEx = New RegExp > regEx.Pattern = "\.processed$" > regEx.IgnoreCase = True > > > set files = folders.files > wscript.echo "" > wscript.echo "Deleting Files under the Folder:" & folders.path > wscript.echo > "__________________________________________________________________________" > for each file in files > > if regex.test(file.name) and file.datelastmodified < newdate then > wscript.echo "Deleting " & folders.path & "\" & file.name & " last > modified: " & file.datelastmodified > on error resume next > file.delete > end if > > next > > > It worked. > > > "Stacey" wrote: > Quote: >> First I am not a programmer. I have done a little scripting. >> >> Here is the problem: >> >> >> Ha a program that creates log files Audit1.log, audit2.log ect. in >> c:\logs >> . Another program comes along and reads the file into its database and >> renames the file audit1.log.proccessed. >> >> I have tried to write a script that will delete any files with .processed >> but it will not work. I belive the problem is that it reads from left to >> right and sees the .log only. >> >> Any ideas? >> >> Thank you |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Delete all .processed files "billious" <billious_1954@xxxxxx> wrote in message news:4a007510$0$12588$5a62ac22@xxxxxx-qv1-newsreader-01.iinet.net.au... Quote: > Crikey! > > Perhaps if a real programmer had stopped by, they'd have suggested > > DEL /s *.processed > > from the command-prompt. > > But real programmers are becoming rare nowadays. A *REAL* scripter would have been more likely to come up with the simple solution. /Al Quote: > "Stacey" <Stacey@xxxxxx> wrote in message > news:315CED02-16C5-4ED8-BCD5-B4574A533E87@xxxxxx Quote: >> Okay 20 minutes after this post a programmer stopped by. >> >> >> sub recurse( byref folders) >> >> Set regEx = New RegExp >> regEx.Pattern = "\.processed$" >> regEx.IgnoreCase = True >> >> >> set files = folders.files >> wscript.echo "" >> wscript.echo "Deleting Files under the Folder:" & folders.path >> wscript.echo >> "__________________________________________________________________________" >> for each file in files >> >> if regex.test(file.name) and file.datelastmodified < newdate then >> wscript.echo "Deleting " & folders.path & "\" & file.name & " last >> modified: " & file.datelastmodified >> on error resume next >> file.delete >> end if >> >> next >> >> >> It worked. >> >> >> "Stacey" wrote: >> Quote: >>> First I am not a programmer. I have done a little scripting. >>> >>> Here is the problem: >>> >>> >>> Ha a program that creates log files Audit1.log, audit2.log ect. in >>> c:\logs >>> . Another program comes along and reads the file into its database and >>> renames the file audit1.log.proccessed. >>> >>> I have tried to write a script that will delete any files with >>> .processed >>> but it will not work. I belive the problem is that it reads from left to >>> right and sees the .log only. >>> >>> Any ideas? >>> >>> Thank you > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
Why cant I delete certain files | General Discussion | |||
| unable to delete Names of files after deleted files. | Vista mail | |||
| Possible to Read only Selected lines from multiple files into anotherfile deleting source files when processed? | PowerShell | |||
| cant delete files or rename files | Vista security | |||
| What files keep & what files delete after upgrade ? | Vista installation & setup | |||