windowsbatch-file

how to delete only empty directories from a batch file


Is there a way to delete all empty sub-directories below a given directory from a batch file?

Or is it possible to recursively copy a directory, but excluding any empty directories?


Solution

  • To copy ignoring empty dirs you can use one of:

    robocopy c:\source\ c:\dest\ * /s
    xcopy c:\source c:\dest\*.* /s