Jump to content

Howto unlock all file on the dynamic folder


ddk
 Share

Recommended Posts

Hi All,

for single file successed with

Local $handle = FileOpen("test.txt", 0)
FileClose($handle)

is there any way to unlock all file on the dynamic folder?

let's say the folder is "x:\apps\data\000xxx

the "xxx" is randomly number assign

So when the task script code copying new file, there is no error pop-up say "access denied/file in use" again.

Many thanks

Link to comment
Share on other sites

Are the files being locked by the AutoIt script process?

No, the files are weekly data and will updating each week,

I run script at server side and the exe file execute by other users from server share folder.

Edited by ddk
Link to comment
Share on other sites

I got busy and then fell asleep, else I'd have posted this earlier.

Anyway, hopefully you know how to use AutoIt script because I'm not willing to gt too involved in exposing how to use it in great detail.

_UnlockFile("ProcessID - PID", "File path to unlock")

This should work with normal files that have a lock on them by another process, directories can also be unlcked.

"File path to unlock" can also be an array of path strings instead of just a path string.

Hope this helps.

File Unlocker.au3

The above script is basically a

Edited by CaptainClucks
Link to comment
Share on other sites

Also, please be aware that unlocking files can sometimes cause the process that had a lock on the file to go berserk (in very rare cases though), usually when the application was badly written. Most apps will usually just recreate a log file and lock it again when they find out it's missing the handle to it. But on rare occasions, some just want show you who's boss by consuming all the CPU. This has only happened once before, and I can't remember what application it was either, I think it was some kind of task manager.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...