Strange file copy problem

  • Hi

    I'm sure this is an easy one but it has me temporarily stumped. I'm trying to copy a file from a Windows server to a folder on the user's desktop but NSFileManager's copyPath:toPath:handler method won't do it.

    The strange thing is that I can open the file on the server and I can also write files to the exact path I want to copy to (such as writing a dictionary with [dict writeToFile: path atomically YES]) but no go on copying from the server to that path.

    Does NSFileManager's copy method work cross-volume?

    Here are two example paths for reference

    sourcePath = @"/volumes/Windows Server/a folder/a subfolder/source_file_name"
    destPath = @"/users/a_user/desktop/a folder/dest_file_name

    [[NSFileManager defaultManager] copyPath: sourcePath toPath: destPath handler: nil];

    Result: copy fails

    Any help appreciated

    Ken
  • On Jul 2, 2006, at 14:51, <kentozier...> wrote:

    > Hi
    >
    > I'm sure this is an easy one but it has me temporarily stumped. I'm
    > trying to copy a file from a Windows server to a folder on the
    > user's desktop but NSFileManager's copyPath:toPath:handler method
    > won't do it.
    >
    > The strange thing is that I can open the file on the server and I
    > can also write files to the exact path I want to copy to (such as
    > writing a dictionary with [dict writeToFile: path atomically YES])
    > but no go on copying from the server to that path.
    >
    > Does NSFileManager's copy method work cross-volume?

    I've used it across volumes.

    > Here are two example paths for reference
    >
    > sourcePath = @"/volumes/Windows Server/a folder/a subfolder/
    > source_file_name"
    > destPath = @"/users/a_user/desktop/a folder/dest_file_name
    >
    > [[NSFileManager defaultManager] copyPath: sourcePath toPath:
    > destPath handler: nil];
    >
    > Result: copy fails

    Use the handler parameter to supply an object that implements
    fileManager:shouldProceedAfterError: and investigate the error.

    Adam
  • -------------- Original message ----------------------
    From: "Adam R. Maxwell" <amaxwell...>
    >
    > Use the handler parameter to supply an object that implements
    > fileManager:shouldProceedAfterError: and investigate the error.
    >

    Thanks Adam

    Well I tried your suggestion which returned the following

    {Error = "Couldn't open"; Path = "FMG-DATA/CON-PAG/TEMPLATES/AA_template"; }

    Only thing that looks different is that NSFileManager seems to be lopping off the "volumes" part of the path. Other than that, It's correct.

    I checked the permissions and I have read/write access to both the source and destination folder so It should work...
  • Am 02.07.2006 um 23:51 schrieb <kentozier...>:
    > sourcePath = @"/volumes/Windows Server/a folder/a subfolder/
    > source_file_name"
    > destPath = @"/users/a_user/desktop/a folder/dest_file_name

      This is just a guess, but: Have you checked the case of the file
    names? Some file systems are case-sensitive.

    Cheers,
    -- M. Uli Kusterer
    http://www.zathras.de
previous month july 2006 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
Go to today
MindNode
MindNode offered a free license !