Jump to content

Recommended Posts

Posted

Does anyone have a script or suggestions on how to write one that would search for all empty directories/subdirectories and delete them?

Guest checkist
Posted

Well, ultra-ugly, super-inefficient method is..

cmd /c Xcopy [source] [temporary target] /s /a/h

delete [source], and rename [temporary target] directory to original [source]

Xcopy's '/s' switch recursively copies "Nonempty" subdirectories.

It may work. but it's too slow for any practical use.

(In short, this is useless)

Posted

Hi,

there are various recursive FileSearch" utilities on the forum.

At least one of them searches for directories too;

FileSearch gafrost

When you get to

              $hFile = FileFindFirstFile($szRoot & "*.*")

              If $hFile >= 0 Then

I imagine you could do an "else" (if no files ie empty), delete the current directory, or add name to a file for checking and deleting at the end from the file? -Interested to hear if you get it going!

Randall

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...