#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Posts
    5
    Rep Power
    0

    Need script-delete files recursively+files older than + custom values for each folder


    I need a script to delete files within a folder.

    * It must delete files recursively
    * It must accept delete files older than "value" for each folder within the parent folder (which i would mention explicitly in the script) else it must give me an option to exclude certain folders.

    Many Thanks.
    Last edited by vikrant.forums; August 29th, 2011 at 12:28 PM. Reason: editing title
  2. #2
  3. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,186
    Rep Power
    9398
    Are you prepared to write it yourself given advice and suggestions from us?
    If not, are you prepared to pay money for someone to do it for you?

    Do you realize there's a one-line shell (Unix) command to do this?
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Posts
    5
    Rep Power
    0
    Originally Posted by requinix
    Are you prepared to write it yourself given advice and suggestions from us?
    If not, are you prepared to pay money for someone to do it for you?

    Do you realize there's a one-line shell (Unix) command to do this?

    Yes i am prepared to write it myself, i have seen tons of scripts to delete files older than X days but cant find one where i can explicitly specify folders, also i would like to use a batch script or a vbscript and not for for a unix approach.
  6. #4
  7. Automagically Delicious
    Devshed Regular (2000 - 2499 posts)

    Join Date
    May 2004
    Location
    127.0.0.2 - I live next door.
    Posts
    2,202
    Rep Power
    2737
    Use PowerShell. It's made for doing things exactly like this. Here's a great repository of commands: SS64. I'm doing something almost similar to you right now, it should be accomplished within a few lines of code.
    Adam TT
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Posts
    5
    Rep Power
    0
    As much as i would love to use powershell i can only use a batch or vbscript
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Posts
    5
    Rep Power
    0
    Originally Posted by vikrant.forums
    As much as i would love to use powershell i can only use a batch or vbscript
    vb/batch anyone?
  12. #7
  13. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,446
    Rep Power
    4539
    VBScript with the filesystem object will do what you want. There are example recursive scripts in the filesystem object documentation on the microsoft web site.
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Posts
    5
    Rep Power
    0
    Originally Posted by Doug G
    VBScript with the filesystem object will do what you want. There are example recursive scripts in the filesystem object documentation on the microsoft web site.
    I have found many scripts but not one that lets me specify explicitly for each folder.
  16. #9
  17. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,186
    Rep Power
    9398
    Originally Posted by vikrant.forums
    I have found many scripts but not one that lets me specify explicitly for each folder.
    So find the closest example and start modifying it to do what you want. Remember you did say you were willing to do some of the work yourself.

    Comments on this post

    • dotfrag agrees

IMN logo majestic logo threadwatch logo seochat tools logo