Mikl-Ko Posted June 17, 2006 Share Posted June 17, 2006 Help me please!How can I recycle folder contents with subfolders skiping locked files?Now I use the string:FileRecycle(@tempDir & "\*")This workes only when no files locked Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted June 17, 2006 Share Posted June 17, 2006 what do u mean by locked files? you could check out FilegetAtrib something like this not tested but it checks the return of the filegetatrib and if it isnt jsut a normal file then it deletes it $search = FileFindFirstFile(@TempDir & "\*.*") If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop IF Not StringInStr(FileGetAttrib($file),"N") >= "1" Then FileDelete($file) EndIf WEnd FileClose($search) Link to comment Share on other sites More sharing options...
Mikl-Ko Posted June 17, 2006 Author Share Posted June 17, 2006 1) By locked files I mean files used by programs. For instence if u open AutoIt Helpe, it creates temporery files in @TempDir and your script fail. 2)Your sceipt can not delete subfolders. Link to comment Share on other sites More sharing options...
piccaso Posted June 17, 2006 Share Posted June 17, 2006 (edited) first you have to gather a list of files.(there are some udf's for this in the forum but i dont remember a name now...)Randallc made a nice listThen you could try to unlock them or FileRecycle() them seperatly.Files which are still locked will fail... Edited June 17, 2006 by piccaso CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map Link to comment Share on other sites More sharing options...
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