There are many cases, and not only in PB, where system operations on file accesses fail because it goes too fast. Often a simple 1, 100 or 500 ms delay is enough to solve the problem and will be invisible to the user.
I often had cases where a Delay(1) solved my problem (without me understanding why) ?
And, as a precaution, it is often necessary to construct the operations (systems) in cascade
Not
Code: Select all
CreateDirectory("D:\Folder1\")
CreateDirectory("D:\Folder1\Folder2\")
CreateDirectory("D:\Folder1\Folder2\Folder3\")
CreateDirectory("D:\Folder1\Folder2\Folder3\Folder4\")
But
Code: Select all
If CreateDirectory("D:\Folder1\")
If CreateDirectory("D:\Folder1\Folder2\")
If CreateDirectory("D:\Folder1\Folder2\Folder3\")
If CreateDirectory("D:\Folder1\Folder2\Folder3\Folder4\")
(With Delay() and Break inside each if /EndIf)