GetNewestFile locks directory
Moderators: JRL, Dorian (MJT support)
GetNewestFile locks directory
Whe I use GetNewestFile>DirName,FileList , the command locks the directory 'DirName' . Even the macro stops the lock is there.
MS must be closed to delete the lock.
What must be done to solve this ?
MS must be closed to delete the lock.
What must be done to solve this ?
Re: GetNewestFile locks directory
Interesting... Just tested, I've never used the function before. Its seems to be creating a temporary file at the path location and that file is locked by Macro Scheduler. The rest of the directory seems to be ok but that temporary file is untouchable.
Re: GetNewestFile locks directory
A little more testing. In my initial test I was looking at my %temp_dir% and apparently locking temporary file being created by Firefox. The files were locked until I closed Firefox then they just went away on their own. Otherwise I'm not seeing any issues with GetNewestFile>. (Not that locking other apps temporary files isn't an issue, I'll be reporting it.)
Can you provide any more detail about your experience?
Can you provide any more detail about your experience?
Re: GetNewestFile locks directory
Hi,
I'm using Win7(64) and MS 14.1
It's very simple. The program loops and is waiting for incoming files, if a file is found it send a message and deletes the file.
After 10 minutes it closes himself. Now the parent program tries to delete the working dir, but it is locked by MS. Only when im closing MS complettly, the locks on this directory are removed.
Thank's for your fast answer.
I'm using Win7(64) and MS 14.1
It's very simple. The program loops and is waiting for incoming files, if a file is found it send a message and deletes the file.
After 10 minutes it closes himself. Now the parent program tries to delete the working dir, but it is locked by MS. Only when im closing MS complettly, the locks on this directory are removed.
Thank's for your fast answer.
Re: GetNewestFile locks directory
I can confirm your issue.
I compiled this script which creates a directory named VaderTest then writes a file to that directory every five seconds until it has written 5 files, Then it completes.
Then started this script which looks for a file to exist in directory VaderTest, if a file exists the file is deleted. It deletes five files then completes.
Then ran the compiled script. The two programs ran to completion. The folder %temp_dir%VaderTest was not deleted by the executable and could not be deleted until I exited from Macro Scheduler.
Does this make sense?
Hopefully this can be addressed in the next release. In the mean time have you tried using GetFileList> rather than GetNewestFile>?
I compiled this script which creates a directory named VaderTest then writes a file to that directory every five seconds until it has written 5 files, Then it completes.
Code: Select all
CreateDir>%temp_dir%VaderTest
Wait>5
Let>kk=0
Repeat>kk
Add>kk,1
WriteLn>%temp_dir%VaderTest\temp_%kk%.txt,wres,Delete this file
Wait>5
Until>kk=5
Wait>5
DeleteFolder>%temp_dir%VaderTest
MDL>VaderTest.exe Complete
Code: Select all
Let>kk=0
Label>ReDo
Wait>0.1
GetNewestFile>%temp_dir%VaderTest\*.txt,vFile
IfFileExists>vFile
DeleteFile>vFile
Add>kk,1
EndIf
If>kk=5
Exit>0
EndIf
Goto>ReDo
Does this make sense?
Hopefully this can be addressed in the next release. In the mean time have you tried using GetFileList> rather than GetNewestFile>?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: GetNewestFile locks directory
I don't think this is caused by GetNewestFile. For one I can't see why it would.
In JRL's scenario I think this is caused by DeleteFile. If DeleteFile (which calls an operating system function) is deleting a file at the same time the .exe is trying to delete the folder, then clearly the folder can't be deleted.
I just commented out the DeleteFile statement from the second script and ran the test and the folder was successfully deleted. I think that proves my point. I ran the script over and over while the .exe was running.
The second script could call GetNewestFile as many times as it liked and it made no difference.
But put the DeleteFile back in and you get a collision between DeleteFile and DeleteFolder and the folder is not deleted.
In JRL's scenario I think this is caused by DeleteFile. If DeleteFile (which calls an operating system function) is deleting a file at the same time the .exe is trying to delete the folder, then clearly the folder can't be deleted.
I just commented out the DeleteFile statement from the second script and ran the test and the folder was successfully deleted. I think that proves my point. I ran the script over and over while the .exe was running.
The second script could call GetNewestFile as many times as it liked and it made no difference.
But put the DeleteFile back in and you get a collision between DeleteFile and DeleteFolder and the folder is not deleted.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: GetNewestFile locks directory
I think it's the combination of GetNewestFile and DeleteFile.
The directory is locked when I use first GetNewestFile and then DeleteFile and this so on until the directory is empty.
This empty directory is locked until MS is complety exited.
The directory is locked when I use first GetNewestFile and then DeleteFile and this so on until the directory is empty.
This empty directory is locked until MS is complety exited.
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: GetNewestFile locks directory
I'll investigate some more.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?