Guys,
I need to empty a shared folder on a server at a regular point every week. Ive had a look at using batch files, but it wont let me empty the folder.
Any ideas?
Wol
Guys,
I need to empty a shared folder on a server at a regular point every week. Ive had a look at using batch files, but it wont let me empty the folder.
Any ideas?
Wol
Surely you can create a .bat that goes to the directory you want and does del *.* and stick that into scheduled tasks?
del *.* /Q will delete files only without asking for confirmation. Enter 'help del' or 'help erase' at the prompt (presumably your using XP?)
What do you mean, it won't 'let' you?
Last edited by yamangman; 18-10-2004 at 07:56 PM.
To err is human. To really foul things up ... you need a computer.
del {drive:}\{path}\{folder to be emptied}\*.* /S (specifies removal of all files in subdirectories) /F (force deletion of read-only files) /Q (quiet mode; suppresses confirmation requests)?
What isn't it letting you clean out?
It cleans the files fine with that, but not the subfolders as well! Grr
EDIT: I should have said that i'd tried that one already.
Last edited by wol; 19-10-2004 at 08:42 AM.
I'd do it throught a VBScript.
The DeleteFile & DeleteFolder methods would work fine. Get it to list the folder contents first and apply the correct method to each.
rmdir? and mkdir?
TiG
-- Hexus Meets Rock! --
It wont be shared if the folder is deleted then remade.
Grrr this should be nice and simple, might have to see if i can make a program using my old Delphi skills
3-line batch file:
As the current working directory of the process is the folder you are trying to delete, it fails (as designed), but only after deleting all files and sub-folders within.Code:x: cd \path_to_folder\whose_contents\to_delete rd /s /q \path_to_folder\whose_contents\to_delete
Replace x: with the appropriate drive letter.
Schedule this batch file to run locally on the server at the required time, and you're done.
~ I have CDO. It's like OCD except the letters are in alphabetical order, as they should be. ~
PC: Win10 x64 | Asus Maximus VIII | Core i7-6700K | 16GB DDR3 | 2x250GB SSD | 500GB SSD | 2TB SATA-300 | GeForce GTX1080
Camera: Canon 60D | Sigma 10-20/4.0-5.6 | Canon 100/2.8 | Tamron 18-270/3.5-6.3
cool cheers ill give it a go
There are currently 1 users browsing this thread. (0 members and 1 guests)