Sign in to follow this  
Followers 0
nanodroid

Create Autoit delete Temp file script

3 posts in this topic

Hi, I have been working with autoit for about a week now and I have been going through some of the examples that it provides with the download just to get familar with the program. I would like to try my hand at creating a script that will allow me to delete %temp% files and prefetch files, and also any KB* bug fixes in the windows folder....I'm a novice at this and would like to become and expert at this great program , so any assistance would be greatly appreciated....Thanks...Also if you guys have any great books on scripting for beginngers that you can point me to that would be great as well.

I want to learn as much as possible....with Autoit.

Share this post


Link to post
Share on other sites



This will do it.

Local $aFldrs[4] = [EnvGet("temp"), "C:\temp", @WindowsDir & "\temp", @WindowsDir & "\prefetch"]
For $i = 0 To UBound($aFldrs) - 1
    If MsgBox(1, "Folder", $aFldrs[$i]) = 2 Then ContinueLoop
    If FileExists($aFldrs[$i]) Then
        DirRemove($aFldrs[$i], 1)
        DirCreate($aFldrs[$i])
    EndIf
Next

Caveate: If you hit a file in the Temp folder that is in use then no more files in that folder will be processed. The way you would normally handle it is by going file by file and deleting them with error checking to continue the loop when the file can not be deleted.

By the way. I only used the message box to allow me to cancel clearing my prefetch while testing since I don't want that folder touched.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Look at here for some which may help you for beginners guide :mellow:


Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0