In my application I need to access the file system to carry out a number of activities.
There is a folder (orginalQuoteFolder) that contains a number of subfolders, many of which contain files.
I need to move this folder to a new location (newQuoteFolder) using something like:
Dim FSO As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
FSO.movefolder originalQuoteFolder, newQuoteFolder
' move the Quote folder
Set FSO = Nothing
This usually works but the client says that it occasionally fails. They claim, although I have not seen the evidence, that this is because one or more of the contained files is open by another user.
Q1: Is this likely to be true?
i.e is it only possible to move a folder if all its contained files are closed?
Q2: If the move fails for this reason, how can one determine which file is open and which user has opened it?In case of an error, the error number can be evaluated.
Hi,I don't know to tell who has a file open using FSO. Using <Control panel / Administrative Tools / Computer Management / Shared Folders / Open Files> on the computer with the file, will show who has file open.
Am 15.02.2023 um 17:37 schrieb Keith Tizzard:
In my application I need to access the file system to carry out a number of activities.
There is a folder (orginalQuoteFolder) that contains a number of subfolders, many of which contain files.
I need to move this folder to a new location (newQuoteFolder) using something like:
Dim FSO As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
FSO.movefolder originalQuoteFolder, newQuoteFolder
' move the Quote folder
Set FSO = Nothing
This usually works but the client says that it occasionally fails. They claim, although I have not seen the evidence, that this is because one or more of the contained files is open by another user.
Q1: Is this likely to be true?
i.e is it only possible to move a folder if all its contained files are closed?
That's correct.
Q2: If the move fails for this reason, how can one determine which file is open and which user has opened it?In case of an error, the error number can be evaluated.
Unfortunately, I don't know of any way to tell who opened the file.
Ulrich
On Thursday, February 16, 2023 at 3:14:59 AM UTC-6, Ulrich M||ller wrote:If this were Unix I could most likely find and run the program that produces this. And then pipe its output through a filter to select just those files in the folder of interest.
Hi,
Am 15.02.2023 um 17:37 schrieb Keith Tizzard:
In my application I need to access the file system to carry out a number of activities.
There is a folder (orginalQuoteFolder) that contains a number of subfolders, many of which contain files.
I need to move this folder to a new location (newQuoteFolder) using something like:
Dim FSO As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
FSO.movefolder originalQuoteFolder, newQuoteFolder
' move the Quote folder
Set FSO = Nothing
This usually works but the client says that it occasionally fails. They claim, although I have not seen the evidence, that this is because one or more of the contained files is open by another user.
Q1: Is this likely to be true?
i.e is it only possible to move a folder if all its contained files are closed?
That's correct.
Q2: If the move fails for this reason, how can one determine which file is open and which user has opened it?In case of an error, the error number can be evaluated.
Unfortunately, I don't know of any way to tell who opened the file.
UlrichI don't know to tell who has a file open using FSO. Using <Control panel / Administrative Tools / Computer Management / Shared Folders / Open Files> on the computer with the file, will show who has file open.
A quick test on the ability to move a folder is attempting to rename the folder.
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 59 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 18:04:23 |
| Calls: | 810 |
| Calls today: | 1 |
| Files: | 1,287 |
| D/L today: |
10 files (21,017K bytes) |
| Messages: | 193,396 |