Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Logon scripts to delete all files & folders from local drives

Status
Not open for further replies.

bickyatbickyz

Technical User
Nov 9, 2007
29
GB
Hi, has anybody got logon script that will delete all the Files & Folders from the E: drive of all my windows xp clients.

I was thinking of using batch file with
del e:\*.* /q
but it will only delete files but no the folders.
 
and you're doing this why?

I'm Certifiable, not cert-ified.
It just means my answers are from experience, not a book.
 
Bascially all the temporary users are saving the un-necessary files in the E: drive. So i want to clear it to gain the space in the E: drive.

Im in a school environment where users has their own home drive, despite of the home drive they are saving in E: drive.

So basically if i can run this script every 3 weeks, it can clear the files from E: drive.
 
bickyatickyz,

In one of the labs I maintain for a non-profit I volunteer for I do this on every logout with a user logoff script via GPO.

You may/could go with a not as clean solution and use system task scheduler with a local admin account or system level scheduled task (via at) to execute the script on the 3rd Monday of every month or something and take the network out of the equation.

Mark
 
open up notepad and copy the following in:

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFolder "E:\*"
objFSO.DeleteFile "E:\*"

then save the file with a .vbs file extension. should do the trick.
 
Code:
del e:\*.* /q /s /f

/q - quiet
/s - subdirectories
/f - delete read only files

del /?
 
Now that you have cleaned up the mess, prevent it from happening.

faq329-6116

In the above FAQ I have provided ADM file code to be able to hide any drive letter from your users.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top