From LedHed's Wiki
Jump to: navigation, search

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


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