?
Solved

Script

Posted on 2007-10-10
6
Medium Priority
?
218 Views
Last Modified: 2010-04-16
I am looking to write a script that would run on weekends only to delete all temp files on our file servers. So the script would need to be triggered to run without manual intervention.
0
Comment
Question by:SuperFly07
5 Comments
 
LVL 1

Expert Comment

by:imsysadmin
ID: 20051713
You don't need vbscript for this, just a batch file will do:

del c:\temp\*.* /y
del c:\windows\temp\*.* /y

Put those lines in deltemp.bat, change the directories to whatever you need cleared, and make the .bat file a scheduled task on the server for whenever you prefer on the weekend.
0
 
LVL 65

Accepted Solution

by:
RobSampson earned 1000 total points
ID: 20052584
You may be better off running

RD C:\Temp /s /q
MD C:\Temp
RD C:\Windows\Temp /s /q
MD C:\Windows\Temp

which will delete all subfolders from those Temp folders as well.

Regards,

Rob.
0
 

Author Comment

by:SuperFly07
ID: 20052825
Out fileserver is my X-drive. Can we write a script that would clean all temp files from X drive? Reason being temp files can be scattered all over the place.
0
 
LVL 1

Assisted Solution

by:imsysadmin
imsysadmin earned 1000 total points
ID: 20053200
Perhaps you could tell us what "temp" files means to you?  Are you saying files that end in *.tmp ?  

If so, then your batch file could just be:

del x:\*.tmp /s /q

That will do the root of X: and all subdirectories, and delete all files ending in .tmp without prompting you for anything.
0
 
LVL 1

Expert Comment

by:Computer101
ID: 21046220
Forced accept.

Computer101
EE Admin
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses
Course of the Month13 days, 18 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question