5

I have the following powershell script, which executes a few robocopy commands:

ROBOCOPY.exe $q3 $q4 /R:5 /W:15 /S /NP /MT:32 /XA:SH /XJD
ROBOCOPY.exe $q2 $q3 /R:5 /W:15 /S /NP /MT:32 /XA:SH /XJD
ROBOCOPY.exe $q1 $q2 /R:5 /W:15 /S /NP /MT:32 /XA:SH /XJD
ROBOCOPY.exe $src $q1 /R:5 /W:15 /S /NP /MT:32 /XA:SH /XJD

This works fine, but it takes a really long time, I'm wondering, if there is a way that I can have robocopy do a "cut + paste" instead of a "copy + paste" so windows will move the NTFS pointer to the file, instead of actually copying all of the bits of each file?

3 Answers 3

9

The /MOV option is designed to do exactly that. Check your specific version of robocopy for it (robocopy /? should show the option).

enter image description here

3
  • RoboCopy.exe with /MOVE used to delete source files, but now it sees the source is the same as destination and leaves the source. Win2008r2. MS knows there are problems with RoboCopy. Very Disappointing.
    – rjt
    Mar 22, 2012 at 20:45
  • 2
    not correct answer - robocopy with /MOV parameter actually copies&deletes files, instead of just moving and changing pointer. Which is the original question
    – peterson
    Sep 30, 2015 at 11:21
  • 1
    yes, tested this in Windows 10 and robocopy is still copying files
    – churchill
    Jul 21, 2022 at 14:17
1

Robocopy only leaves empty source folders when using /MT (in my case 32) switch, if I don't use /MT everything is moved, running on 2008R2.

1

move or move-item

Move-Item -Path $source -Destination $source

I believe the existence of the move & ren commands is part of the reason why robocopy doesn't move the pointer (robocopy wants to be robust & recoverable).

Might want to check if it was on the same logical drive on the same machine before deciding to use move or robocopy:

$source_root = [System.IO.Path]::GetPathRoot($source)
$dest_root = [System.IO.Path]::GetPathRoot($dest)
if($source_root -like $dest_root){...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .