edie209 Posted November 28, 2007 Posted November 28, 2007 I want to create a short term share, one that will be empty every Monday morning. The reason behind this is teachers claiming they need to have an area to collect students work but want it to be deleted at the end of the week. Well no problem there I thought I would just schedule a bat file to delete the directory on Friday nights simple. but no. del command only deletes files not folders or at least I thought so I found a reference to /s switch that should delete folders but it won't for me. And it seems deltree won't work with a wildcard Anyone got another suggestion. I need the share to always remain but the contents to be deleted on a weekly basis
CyberNerd Posted November 28, 2007 Posted November 28, 2007 what about recursively deleting files that are over 1 week old
mac_shinobi Posted November 28, 2007 Posted November 28, 2007 DEL /S C:/PATH/to/BASEDIR/*.* obviously *.* will delete everything, best to try it on a test directory first just to ensure it works how you want it to.
edie209 Posted November 28, 2007 Author Posted November 28, 2007 /S doesn't seem to delete folders either I have been trying DEL /S/f/q C:/PATH/to/BASEDIR/*.* and DEL /s/f/q C:/PATH/to/BASEDIR/*.*
mac_shinobi Posted November 28, 2007 Posted November 28, 2007 http://www.daniweb.com/forums/thread61479.html May take a lil while to load the page but hopefully that helps
OutToLunch Posted November 28, 2007 Posted November 28, 2007 Follow up CD "FULLPATHTODIRTOBECLEANED" DEL *.* /Q with for /D %I in (*) do RMDIR "%I" /S /Q DEL *.* will delete contents in the top level folder The FOR will loop and remove all directories and their subdirectories. In a batch file you'll need %%I, on the command line %I HTH
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now