Jump to content

Recommended Posts

Posted

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

Posted

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)
Posted

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.

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
×
×
  • Create New...