Sign in to follow this  
Followers 0
Mikl-Ko

How can I recycle folder contents with subfolders locked files?

4 posts in this topic

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

Share this post


Link to post
Share on other sites



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)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 list

Then you could try to unlock them or FileRecycle() them seperatly.

Files which are still locked will fail...

Edited by piccaso

CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map

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