none
Problem copying files to folders. RRS feed

  • Question

  • All;

    I am copying files on one server/folder to another server/folder - usually no problems there. However, when copying to a particular server share, there are no errors/exceptions using my.computer.filesystem.copyfile and my.computer.filesystem.FileExists returns true. But, the file is not in the target folder. Any ideas why this is happening?

    Thanks in advance,

    Jim

    Tuesday, July 10, 2018 6:55 PM

Answers

  • Sounds like maybe it is a weird permissions issue of some sort?  Does the user who is looking for the files have permissions to see those written by the user who did the copying?  I'm not sure what else would be causing this unless maybe that folder has some other security restriction and some security app/feature is deleting the files... can you log changes to the directory on the server-side, or dig into the storage at a lower level to verify if there is some kind of data file being created?  Beyond that, maybe a failing disk drive?

    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    • Marked as answer by JimHuffman Wednesday, July 11, 2018 2:05 PM
    Tuesday, July 10, 2018 9:09 PM
    Moderator

All replies

  • Sounds like maybe it is a weird permissions issue of some sort?  Does the user who is looking for the files have permissions to see those written by the user who did the copying?  I'm not sure what else would be causing this unless maybe that folder has some other security restriction and some security app/feature is deleting the files... can you log changes to the directory on the server-side, or dig into the storage at a lower level to verify if there is some kind of data file being created?  Beyond that, maybe a failing disk drive?

    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    • Marked as answer by JimHuffman Wednesday, July 11, 2018 2:05 PM
    Tuesday, July 10, 2018 9:09 PM
    Moderator
  • Hi Jim

    Is this an error?

    You can try the following method:

    https://docs.microsoft.com/en-gb/previous-versions/visualstudio/visual-studio-2008/bwfbss93%28v%3dvs.90%29

    ' Copy the file to a new location without overwriting existing file.
    My.Computer.FileSystem.CopyFile( _
        "C:\UserFiles\TestFiles\testFile.txt", _
        "C:\UserFiles\TestFiles2\testFile.txt")
    
    ' Copy the file to a new folder, overwriting existing file.
    My.Computer.FileSystem.CopyFile( _
        "C:\UserFiles\TestFiles\testFile.txt", _
        "C:\UserFiles\TestFiles2\testFile.txt", _
        FileIO.UIOption.AllDialogs, _
        FileIO.UICancelOption.DoNothing)
    
    ' Copy the file to a new folder and rename it.
    My.Computer.FileSystem.CopyFile( _
        "C:\UserFiles\TestFiles\testFile.txt", _
        "C:\UserFiles\TestFiles2\NewFile.txt", _
        FileIO.UIOption.AllDialogs, _
        FileIO.UICancelOption.DoNothing)

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, July 11, 2018 3:00 AM
  • @Alex,

    Read the thread more carefully before adding unrelated posts.  The OP stated:
    "there are no errors/exceptions using my.computer.filesystem.copyfile…"


    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Wednesday, July 11, 2018 11:38 AM
    Moderator
  • Reed,

    As much as I hate to admit it - for whatever reason the system is not seeing the drive to an AS400 file share. Thus, the target folders were created on the Source server and files copied to those folders. Hence, the file copy succeeds and the FileExists reports true.

    Thanks to you and Alex both for your helpful replies! I am convinced that there are permissions/valid user issues between the AD and AS400 that have to be worked out.

    Thanks,

    Jim

    Wednesday, July 11, 2018 2:12 PM
  • No problem Jim.  It sounds like something you'll have to fix in ClientAccess; double check the user account association between windows and db2 and recreate the share and drive mapping in Windows if necessary.

    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Wednesday, July 11, 2018 8:04 PM
    Moderator