From LedHed's Wiki
Jump to: navigation, search

Robocopy is a powerful copy tool and its now included in Windows 2008.


Overview

If you're here its most likely because you created a copy loop due to NTFS junction points.

If so you probably have a folder with more files or subfolders than the NTFS filesystem can handle.
Deleting them isn't really an option as it would take you years to get through them all.

You may be thinking about formatting your drive, but this handy little trick may save you a lot of grief (I know it did for me).


Using Robocopy to unloop itself!

Robocopy has a /PURGE feature that you can use to remove the thousands/millions of usless files and folder.

First create an empty folder

mkdir c:\empty

Second, run robocopy with the purge option against your looped folder (the one with thousands of files/folders)

robocopy c:\empty c:\Users\someone /purge

Presto!! All those nasty files are gone.



Preventing Robocopy from Looping

Robocopy has two command switches that can prevent you from doing this in the future.

/XJF  -  Exclude Junctioned Files
/XJD  -  Exclude Junctioned Directories



References

http://www.sevenforums.com/general-discussion/60292-robocopy-mass-nesting-bug.html


http://answers.microsoft.com/en-us/windows/forum/windows_7-files/windows-7-infinite-loop-while-using-robocopy/20f32f0c-4cb9-4125-923d-6a57e4d27232