Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Check if folder is locked
#1
When I save a webpage using firefox through: FILE > SAVE PAGE AS , many files and folders are downloaded.
Through QM I want to wait until everything is downloaded. Normally I use the arrow icon which turns blue (rightside of the address bar).
BUT I want to use the QM script in compiled exe form so it can be used by other users.
The problem with this is, is that the arrow icon might not visible or even present in the firefox browser of the other user.

That's why I want to check the folder itself while it is downloading the items (webpage). Because while downloading into a folder, that folder can not be deleted. So I assume it is locked in some way.

That's why I want to know if it is possible to check if a folder is locked.

I know there is:

1.  __HFile f.Create(_file OPE...
2.  FileGetAttributes with FILE_ATTRIBUTE_READONLY

But 1 is for files (at least, I assume it is. I could not find a folder method) and 2 doesn't work while firefox is downloading into a folder  (I tried).

Macro Macro168
Code:
Copy      Help
int attr=FileGetAttributes("$desktop$\2\test") ;; does NOT work while firefox is downloading into that folder...
if(attr&FILE_ATTRIBUTE_READONLY) out "READONLY"

I also tried to search for a command line method, but many suggest to check if a file is locked within that folder OR to write a file (text) into that folder...
#2
__HFile f.Create uses API CreateFileW, which can open a directory handle too for certain purposes. Read CreateFileW documentation, the Directories chapter. I don't know if it can be useful. Call CreateFileW directly, and then CloseHandle.

Or try to rename. Maybe error if locked.
#3
Ok will do, thanks!!!


Forum Jump:


Users browsing this thread: 1 Guest(s)