cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
djhanson
Level V

Copy File() - network dest doesn't work

Any reason why the below example won't work?  I get zero for the return, which means the file didn't copy and I can see that it didn't copy.  I can manually copy it fine via Windows 10. 

 

Question: does JSL File Copy() not like UNC (I think) network destinations perhaps?  

 

Copy File(
    "\\mywork1.work.com\folder1\source\test1.csv",
    "\\mywork2.work.com\folder2\dest\test1.csv"
);

 

File Copy() seems to work fine elsewhere, even if the source is a UNC network path.

1 ACCEPTED SOLUTION

Accepted Solutions
djhanson
Level V

Re: Copy File() - network dest doesn't work

Ok, I just discovered the fix.  In order to copy to a network dest (UNC), you must first delete the dest file if it already exists.

 

 

Delete File( "\\mywork2.work.com\folder2\dest\test1.csv" );

Copy File(
    "\\mywork1.work.com\folder1\source\test1.csv",
    "\\mywork2.work.com\folder2\dest\test1.csv"
);

 

 

If you don't first delete out any existing file, presumably as it has to overwrite it, it will not execute the copy.  I don't know if it's possible in the future to put a switch or variable in the Copy File() like overwrite ("Y" or "N").  That would make this a little more obvious probably.

View solution in original post

2 REPLIES 2
djhanson
Level V

Re: Copy File() - network dest doesn't work

* meant Copy File() here
djhanson
Level V

Re: Copy File() - network dest doesn't work

Ok, I just discovered the fix.  In order to copy to a network dest (UNC), you must first delete the dest file if it already exists.

 

 

Delete File( "\\mywork2.work.com\folder2\dest\test1.csv" );

Copy File(
    "\\mywork1.work.com\folder1\source\test1.csv",
    "\\mywork2.work.com\folder2\dest\test1.csv"
);

 

 

If you don't first delete out any existing file, presumably as it has to overwrite it, it will not execute the copy.  I don't know if it's possible in the future to put a switch or variable in the Copy File() like overwrite ("Y" or "N").  That would make this a little more obvious probably.