- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Copy File() - network dest doesn't work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.