Page 1 of 1 1
Topic Options
#209366 - 2014-08-06 09:46 PM move not work over unc paths?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I keep getting error 5 moving folders with kixtart move.

it is not with all of them which made me think there is something funny about directory permissions that I am not getting, but I can just drag and drop them folders manually from server to another.
_________________________
!

download KiXnet

Top
#209367 - 2014-08-07 01:43 PM Re: move not work over unc paths? [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
Saw the documentation about having to use trailing slash. Tried. No change. Added /r, no change. Added /h, still no change. I guess I need to shell out once again.
_________________________
!

download KiXnet

Top
#209368 - 2014-08-07 02:03 PM Re: move not work over unc paths? [Re: Lonkero]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4563
Loc: USA
UAC on?
Top
#209369 - 2014-08-07 02:29 PM Re: move not work over unc paths? [Re: Allen]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Testing in my office. The two folders on the file server - Scans and HomeScans - are not mapped to the workstation and are normally used only by the two network scanners. I thought that, since these were writable by all but not mapped to any, it would be a good test of the Move command on UNC paths. Test code shown below:
 Code:
Break On

CLS

'local Drive to UNC' ?
move C:\Temp\tst.txt \\ihwifpsp01\Scans
'Move: ' @SERROR ?
$ = Dir('C:\Temp\tst.txt')
' Src: ' @SERROR ?
$ = Dir('\\ihwifpsp01\Scans\tst.txt')
' Dst: ' @SERROR ? ?

'UNC to UNC' ?
move \\ihwifpsp01\Scans\tst.txt \\ihwifpsp01\HomeScans
'Move: ' @SERROR ?
$ = Dir('\\ihwifpsp01\Scans\tst.txt')
' Src: ' @SERROR ?
$ = Dir('\\ihwifpsp01\HomeScans\tst.txt')
' Dst: ' @SERROR ? ?

'UNC to local Drive' ?
move \\ihwifpsp01\HomeScans\tst.txt C:\Temp
'Move: ' @SERROR ?
$ = Dir('\\ihwifpsp01\HomeScans\tst.txt')
' Src: ' @SERROR ?
$ = Dir('C:\Temp\tst.txt')
' Dst: ' @SERROR ? ?
The three tests are Drive to UNC, UNC to UNC, and UNC to Drive. After each move, the status of the Move command and is displayed, and DIR commands are run to check the source (should be "not found") and destination (should be "success") paths to determine if the file is present. This works for me running as a regular user, with the following rights:
Share Permission - Everyone/Full
NTFS Permission: - SYSTEM & Administrators/Full; Employees/Modify
Works on my network:
 Code:
local Drive to UNC
Move: The operation completed successfully.
 Src: The system cannot find the file specified.
 Dst: The operation completed successfully.

UNC to UNC
Move: The operation completed successfully.
 Src: The system cannot find the file specified.
 Dst: The operation completed successfully.

UNC to local Drive
Move: The operation completed successfully.
 Src: The system cannot find the file specified.
 Dst: The operation completed successfully.
UAC is off by policy on admin & sys-mgmt workstations (mine included).1

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#209370 - 2014-08-07 03:04 PM Re: move not work over unc paths? [Re: Glenn Barnas]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I do have UAC on...

just can't see how that would affect anything. I am not doing anything locally that would trigger UAC block. everything is remote:
 Code:
move '\\server1\ashare$\foldername\' '\\server2\ashare$\foldername\' /h /r
@error ' ' @serror ?


is what gives me access denied.
_________________________
!

download KiXnet

Top
#209373 - 2014-08-07 04:38 PM Re: move not work over unc paths? [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
not sure if @result is set for move, because I get:
"ERROR moving folder from old location: 5 Access is denied. 1 file(s) deleted."

with
 Code:
? "ERROR moving folder from old location: " @ERROR " " @SERROR ' ' @RESULT ?
_________________________
!

download KiXnet

Top
#209374 - 2014-08-07 04:48 PM Re: move not work over unc paths? [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
k... doing:
 Code:
	  if not exist($location+'\')
	   md $location+'\'
	   if @error ;and @error<>183
	  	 ? "ERROR creating homedrive folder: " @ERROR " " @SERROR ?
		 "location: " $location ?
		 "uPrincipal: " $ad_user[4] ?
		 $ = redirectoutput('')
		 exit 2
	   endif
	  endif
	  move $ad_user[7]+'\' $location /r /h
	  if @error
	  	? "ERROR moving folder from old location: " @ERROR " " @SERROR ' ' @RESULT ?
		'from: ' $ad_user[7] ?
		'to: ' $location ?
		"uPrincipal: " $ad_user[4] ?
		$ = redirectoutput('')
		exit 1
	  endif


still fails with move error. freakin useless!
_________________________
!

download KiXnet

Top
#209376 - 2014-08-07 05:11 PM Re: move not work over unc paths? [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
adding /s will result in error 87 (parameter is incorrect)
_________________________
!

download KiXnet

Top
#209381 - 2014-08-07 09:21 PM Re: move not work over unc paths? [Re: Lonkero]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Sorry - didn't notice you were moving FOLDERS, not FILES.

I get the Error 5 as well on the first MOVE command. I created the folder and thus have full-control rights on it. Tried with and without trailing slashes without change in results.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#209382 - 2014-08-07 11:15 PM Re: move not work over unc paths? [Re: Glenn Barnas]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I wonder what is going on. even ntfsperms() does not work. that one just gives me error=0 on all lines but ACL never gets updated...

just in case something is funky with the permissions on sub folders I did for each loop and ran icacls on them to reset... will see if that helped at all.
_________________________
!

download KiXnet

Top
#209383 - 2014-08-07 11:57 PM Re: move not work over unc paths? [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ok, replaced the ntperms with icacls... it ignores /Q so get an annoying output every time but at least it works.

replaced move with md, copy, del, rd combination. do not still have enough data on it to say if it works that way. given that I have previously complained about RD not working, I am really skeptic about it...
_________________________
!

download KiXnet

Top
#209385 - 2014-08-08 12:29 AM Re: move not work over unc paths? [Re: Lonkero]
Robdutoit Offline
Hey THIS is FUN
***

Registered: 2012-03-27
Posts: 363
Loc: London, England
Just a dumb idea, but have you tried mapping a drive letter to the unc path and then telling move to move to the drive letter. Once the move is complete then you unmap the drive letter. It could be that it just doesn't like something about the UNC path. I appreciate that you said that some UNC paths work but you never know.

I very vaguely remember having problems with the move or delete command in kix some years ago and I shelled the command and used a program - deltree I think! This was not to do with unc, but nevertheless I also had problems using the kix move or delete or something many years ago.

I think it was something to do with the file/directory being locked for some reason.
I have also found copying, then deleting original directory works better than move.

Top
#209386 - 2014-08-08 03:47 AM Re: move not work over unc paths? [Re: Robdutoit]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
In my test, I start with a D: to \\UNC - the failure occurs removing the source folder, not the target.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#209388 - 2014-08-08 04:07 AM Re: move not work over unc paths? [Re: Glenn Barnas]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
in my move test only some of the files got moved. and, I could go back to windows explorer and finish the move. hence, I call it not working. I shall be using copy del combination from now on. just kind of weird that some commands fail with no apparent reason.
_________________________
!

download KiXnet

Top
#209392 - 2014-08-08 08:28 AM Re: move not work over unc paths? [Re: Glenn Barnas]
Robdutoit Offline
Hey THIS is FUN
***

Registered: 2012-03-27
Posts: 363
Loc: London, England
Yes I understand that the problem is with source not destination. But when you think about it, a move is technically - a copy, then delete function. If the copy fails, then the delete fails! Thats why I suggested mapping a drive - for both source and destination as both sides have to work for the move function to work.
Top
#209401 - 2014-08-08 07:37 PM Re: move not work over unc paths? [Re: Robdutoit]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
"ERROR deleting OLD homedir: 5 Access is denied. 427 file(s) deleted."

yea, kixtart just sucks sometimes. yet again I find myself in need of command utilities as kixtart just won't work reliably!
that is, after I spend next hour cleaning the damage it just caused in the past 10 seconds...
_________________________
!

download KiXnet

Top
#209402 - 2014-08-08 09:37 PM Re: move not work over unc paths? [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
argh... robocopy errors out with error 2 after moving most of the files. finishing the directory with windows explorer works fine. this is starting to get really annoying.
_________________________
!

download KiXnet

Top
#209403 - 2014-08-10 08:37 AM Re: move not work over unc paths? [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
Does not make any sense but robocopy changed to error 1 after I disabled filescreens on the source directory. Even more frustrating is the fact that it succeeds and then gives that error. Some sort of voodoo going on...
_________________________
!

download KiXnet

Top
#209404 - 2014-08-11 07:07 PM Re: move not work over unc paths? [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
blaah. searching some and found the reason. robocopy does not comply with normal error codes. it has it's own. basically only error 8 or error 16 means something went wrong.
_________________________
!

download KiXnet

Top
#209405 - 2014-08-11 09:03 PM Re: move not work over unc paths? [Re: Lonkero]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Yeah - that would be the RoboCopy Voodoo. \:D If I hadn't been involved in a datacenter migration this weekend, I might have seen that and sent you my code..
 Code:


        ; define the RoboCopy command parameters and arguments - copy all subfolders including empty subfolders from $Src to \\$Target\$Dst
        ; $Exclude contains exclude statement (if any); $RCArgs contains extra RoboCopy args (if any)
        ; 2 retries on failure, 5 second delay on retry, $RCLogFile contains filespec for log file

        $Cmd = '%COMSPEC% /c ' + $BIN + 'robocopy ' + $Src + ' \\' + $Target + '\' + $Dst + $Exclude + $RCArgs + ' /E /R:2 /W:5 /LOG+:' + $RCLogFile

        fMsg(' Copying from ' + $Src + ' to ' + $Dst, '', 1, 16)	; Log the copy operation

        If Not $DEBUG
          Shell $Cmd
          If @ERROR > 7							; error copying files if 8 or higher
            $Err = 1							; set global error flag
            $fErr = $fErr + 4						; set RoboCopy error bit
            $SErr = ' Error: '						; Handle robocopy error/exit codes (V1.3)
          Else
            $SErr = ' Success: ' 
          EndIf
          $SErr = $SErr + @ERROR + ' - '
          If @ERROR & 16
            $SErr = $SErr + 'Fatal error, no files copied. '
          EndIf
          If @ERROR &  8
            $SErr = $SErr + 'Copy errors, retry exceeded. '
          EndIf
          If @ERROR &  4
            $SErr = $SErr + 'Mismatched files/folders detected, '
          EndIf
          If @ERROR &  2
            $SErr = $SErr + 'Extra files/folders detected, '
          EndIf
          If @ERROR &  1
            $SErr = $SErr + '1+ Files copied, '
          EndIf
          If @ERROR =  0
            $SErr = 'Warning! No files copied. '
          EndIf
        EndIf
        fMsg(': ' + $SErr, '', 0, 17)					; append result to log
        fMsg('  Cmd: ' + $Cmd, '', 0, $DbgLog)				; show command if debug mode
      Next	; next path
Exit of 1 is good, not bad, and exit of 0 might be bad (nothing copied) not good. \:\(

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 778 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.078 seconds in which 0.03 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org