jaxman Posted July 18, 2005 Posted July 18, 2005 I'm trying to empty my Temp dir that contains lots of files, i use for example the filedelete(C:\windows\temp\*.*) function and it starts deleting but some files are being used by windows , so filedelete fails and immediatly stops. Is their any way to force filedelete not to stop if this happens ? I know it's possible to use batch commands and vbscripts but i want to use it with autoit.
FuryCell Posted July 18, 2005 Posted July 18, 2005 delete them individually by using a complicated FileFindFirstFile / FileFindNextFile recursive function... It is possible... not fun...Lar.<{POST_SNAPBACK}>Just made a UDF.DeleteFilesUDF.au3ClearTemp.au3 HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
dash007 Posted July 18, 2005 Posted July 18, 2005 (edited) Brilliant coding there Solid Snake! I tested this on NT and it deleted the files and also files within the folders. Unfortunately it leaves the folders. Anyway that the folders can be deleted too? I know that the folders are empty and don't take up any room, but it is good to delete all folders and leave the 'Temp' folder and 'Temporary Internet files' folder intact (else Windows will complain).... Also I checked and there are no processes blocking the deletion of the 'empty folders' and I can delete them via Explorer easily. Edited July 18, 2005 by dash007
MSLx Fanboy Posted July 18, 2005 Posted July 18, 2005 This should do the trick. If StringInStr(FileGetAttrib($file), "d") Then DirRemove($file, 1) Else FileDelete($file) EndIf Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate())
Valuater Posted July 19, 2005 Posted July 19, 2005 You can also view my script for cleaning alot of areas on your computer herehttp://www.autoitscript.com/forum/index.ph...l=xpclean+menu#or click on the link below for the full executablehope it will help you8)
FuryCell Posted July 21, 2005 Posted July 21, 2005 Brilliant coding there Solid Snake!I tested this on NT and it deleted the files and also files within the folders. Unfortunately it leaves the folders. Anyway that the folders can be deleted too? I know that the folders are empty and don't take up any room, but it is good to delete all folders and leave the 'Temp' folder and 'Temporary Internet files' folder intact (else Windows will complain).... Also I checked and there are no processes blocking the deletion of the 'empty folders' and I can delete them via Explorer easily.<{POST_SNAPBACK}>Thanks for the feedback. About it not deleting folders. It seems to delete them as long as they are empty. It won't however delete a folder that has an in use file in it which I don't think is possible. HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now