• Moving folders and files

    From Keith Tizzard@internet.shopping@foobox.com to comp.databases.ms-access on Wed Feb 15 08:37:24 2023
    From Newsgroup: comp.databases.ms-sqlserv

    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?
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From =?UTF-8?Q?Ulrich_M=c3=b6ller?=@knobbi38@arcor.de to comp.databases.ms-access on Thu Feb 16 10:14:54 2023
    From Newsgroup: comp.databases.ms-sqlserv

    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.

    Ulrich
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Ron Paii@ron81pai@gmail.com to comp.databases.ms-access on Mon Feb 20 14:14:53 2023
    From Newsgroup: comp.databases.ms-sqlserv

    On Thursday, February 16, 2023 at 3:14:59 AM UTC-6, Ulrich M||ller wrote:
    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.

    Ulrich
    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.
    A quick test on the ability to move a folder is attempting to rename the folder.
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Keith Tizzard@internet.shopping@foobox.com to comp.databases.ms-access on Tue Feb 21 11:26:06 2023
    From Newsgroup: comp.databases.ms-sqlserv

    On Monday, 20 February 2023 at 22:14:56 UTC, Ron Paii wrote:
    On Thursday, February 16, 2023 at 3:14:59 AM UTC-6, Ulrich M||ller wrote:
    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.

    Ulrich
    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.

    A quick test on the ability to move a folder is attempting to rename the folder.
    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.
    --- Synchronet 3.21d-Linux NewsLink 1.2