Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

13
  • 4
    Magic. So this moves all non-empty folders to the very same location they were already in (so does nothing?), and skips empty folders? But then: why would skipping them result in deletion? And wouldn't this move nested folders into folder1? Scary, unless tested well.
    – Arjan
    Commented Sep 13, 2015 at 11:15
  • 4
    @Arjan I have tested it, and it works perfectly!. To understand its working, its like moving all files to different location, except empty folders, and then deleting the left-behind empty-folders. /MOVE copies the files first, and then deletes the source file after copying. So, as /S is used, it copies the non-empty folders to destination(same folder in the above case). Then, it deletes the empty folders(like, its thinking that empty-folders has already been copied). No, it does not move nested folders into folder1, as ROBOCOPY moves folders recursively. Commented Sep 13, 2015 at 19:56
  • 4
    it even works with UNC paths (at least on win7) ! Brilliant ! Commented Oct 15, 2015 at 14:11
  • 3
    This is a very elegant solution without any third-party software needed. Thank you! Commented Dec 28, 2017 at 20:20
  • 2
    This just did its magic and worked perfectly. Thanks!
    – CharleyDC5
    Commented Apr 23, 2019 at 14:36