Witto
(MM club member)
2005-08-11 02:09 AM
Move not overwriting when using UNC Path as destination

Using KiXtart 2010 4.50
Code:

Break On
Move "D:\MyFolder\MyFile1.txt" "\\MyComputer\MyShare"
? @ERROR ": " @SERROR
Copy "D:\MyFolder\MyFile2.txt" "\\MyComputer\MyShare"
? @ERROR ": " @SERROR
Move "D:\MyFolder\MyFile2.txt" "\\MyComputer\MyShare"
? @ERROR ": " @SERROR


The kix2010 manual tells for the "Move" command that:
Quote:


MOVE overwrites existing files without warning.




But when moving to an UNC style path and when the destination file exists, the file is not overwritten. The Error Code is 80, telling it exists.


Sealeopard
(KiX Master)
2005-08-11 05:54 AM
Re: Move not overwriting when using UNC Path as destination

The manual also states
Quote:


If the source or target specifies a directory, please make sure to add a trailing backslash




which you forgot. You're now tryig to write a file under the same location as an already existing folder. As windows does not allow this, an error message is generated and the action is not beign performed. This is the correct and desired behavior. Thus, it is a coding error in your code, not a KiXtart or windows bug.


Witto
(MM club member)
2005-08-11 07:57 AM
Re: Move not overwriting when using UNC Path as destination

Code:

Break On
Move "D:\MyFolder\MyFile1.txt" "\\MyComputer\MyShare\"
? @ERROR ": " @SERROR
Copy "D:\MyFolder\MyFile2.txt" "\\MyComputer\MyShare\"
? @ERROR ": " @SERROR
Move "D:\MyFolder\MyFile2.txt" "\\MyComputer\MyShare\"
? @ERROR ": " @SERROR


You are right, but I see no difference.
In my example, the destination path exists.


LonkeroAdministrator
(KiX Master Guru)
2005-08-11 04:28 PM
Re: Move not overwriting when using UNC Path as destination

so, jens, this is a kixtart issue, no?

Witto
(MM club member)
2005-08-29 08:11 PM
Re: Move not overwriting when using UNC Path as destination

This feature is still available in "KiXtart 2010 4.51 Beta 1"

Witto
(MM club member)
2005-09-28 12:47 AM
Re: Move not overwriting when using UNC Path as destination

Also "KiXtart 2010 4.51 Release Candidate 1" is not overwriting when moving to a UNC style path.

iffy
(Starting to like KiXtart)
2005-09-29 09:39 PM
Re: Move not overwriting when using UNC Path as destination

Sealeopard, what version where you using when testing this? Or did you simply quote from the manual? I've also done some quick testing with 4.50 and come to the same conclusion as the topic starter. So it appears not to be a RTFM issue afterall...

The line in the documentation about the trailing backslash is obviously meant when moving directories and not for files.

The overwriting comment is for doing something like this:
Code:
Move "D:\MyFolder\MyFile2.txt" "D:\MyFolder\MyFile3.txt"


The above does overwrite without warning.

So we have:
a) a bug
b) a minor documentation error

"If the source or target specifies a directory, please make sure to add a trailing backslash."

Should be something like:

"When moving directories, please make sure to add a trailing backslash."

Nice double catch Witto.


LonkeroAdministrator
(KiX Master Guru)
2005-09-29 09:55 PM
Re: Move not overwriting when using UNC Path as destination

moved the thread from suggestions to beta and asked ruud to comment on this.

Karl Napp
(Fresh Scripter)
2005-11-29 03:25 PM
Re: Move not overwriting when using UNC Path as destination

Cannot move folders over Shares

Hello!

I run into some difficulties when I try to move folders:

This code works:
Code:
 $src="c:\tmp\sourcefolder\"
$dest="c:\tmp\Destination\"
Move $src $dest



This one doesn't:
Code:
 $src="\\server\share1\sourcefolder\"
$dest="\\server\share2\"
Move $src $dest



Error number and message are:
Quote:

ERROR 123: The filename, directory name, or volume label syntax is incorrect.




I tried it with COM:
Code:
$fso = CreateObject("Scripting.FileSystemObject")
$err=$fso.MoveFolder($src, $dest)
$fso=0



and get no error in both cases (local and remote move) - but nothing happens...

Can somebody please push me in the right direction? I prefer working with Shares.

Thank you very much in advance.


Sealeopard
(KiX Master)
2005-11-30 01:07 AM
Re: Move not overwriting when using UNC Path as destination

Does the MOVE command work from the commandline? I suspect it's not a KiXtart issue as even the COM object fails.

Witto
(MM club member)
2005-12-31 02:08 AM
Re: Move not overwriting when using UNC Path as destination

Also 4.52 Beta1 not overwriting the target if
  • the target exists
  • the target is to be found via an UNC path

Code:

Break On
$ = Open(1, "C:\Test1.txt", 1)
$ = Close(1)
$ = Open(1, "C:\Test2.txt", 1)
$ = Close(1)
Move "C:\Test1.txt" "\\"+@WKSTA+"\C$\Test2.txt"
? @ERROR ": " @SERROR
? @KIX



Witto
(MM club member)
2006-08-02 06:00 PM
Re: Move not overwriting when using UNC Path as destination

Move is still not overwriting in Kix32 4.52 and 4.53 Beta 1.

Ruud van Velsen
(Hey THIS is FUN)
2006-08-03 02:01 PM
Re: Move not overwriting when using UNC Path as destination

Thanks for the report. MOVE indeed still has an issue with overwriting existing files if the target was a UNC. As it turns out, the underlying API returns a different resultcode for files accessed via a UNC.

This is addressed in the next build of 4.53.

Good one, thanks!

Ruud


Witto
(MM club member)
2006-08-03 04:37 PM
Re: Move not overwriting when using UNC Path as destination

Thanks,
I appreciate all input that was given and I look forward to the new version.


Witto
(MM club member)
2006-08-11 01:34 AM
Re: Move not overwriting when using UNC Path as destination

4.53 Beta 2 solved it. Thank you!