Jump to content

Recommended Posts

Posted

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

Posted

/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/*.*

Posted

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...