Windows Vista Forums

Delete all .processed files
  1. #1


    Stacey Guest

    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 SpecsSystem Spec

  2. #2


    Stacey Guest

    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:

    > 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 SpecsSystem Spec

  3. #3


    billious Guest

    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

    > 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:
    >

    >> 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 SpecsSystem Spec

  4. #4


    Al Dunbar Guest

    Re: Delete all .processed files


    "billious" <billious_1954@xxxxxx> wrote in message
    news:4a007510$0$12588$5a62ac22@xxxxxx-qv1-newsreader-01.iinet.net.au...

    > 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.
    I disagree. A *REAL* programmer would have obfuscated the code even more!

    A *REAL* scripter would have been more likely to come up with the simple
    solution.

    /Al

    > "Stacey" <Stacey@xxxxxx> wrote in message
    > news:315CED02-16C5-4ED8-BCD5-B4574A533E87@xxxxxx

    >> 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:
    >>

    >>> 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 SpecsSystem Spec

Delete all .processed files problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete files after copy completes or move files or cut/paste GrJ Computers, Javi, essejc, VB Script 2 14 Nov 2009
unable to delete Names of files after deleted files. paul Vista mail 2 21 Apr 2008
Possible to Read only Selected lines from multiple files into anotherfile deleting source files when processed? joe.hurzeler PowerShell 3 09 Mar 2008
cant delete files or rename files nurselisa Vista security 2 03 May 2007
What files keep & what files delete after upgrade ? 246872 Jim McCree Vista installation & setup 1 13 Feb 2007