Find and delete empty folders?

Discussion, questions and support.
Message
Author
Dirk
Posts: 187
Joined: 02.06.2010, 11:38

Find and delete empty folders?

#1 Post by Dirk » 12.06.2015, 19:14

Can FC find and remove empty folders with 1 or 2 clicks or so?
FC newest stable version, portable
Win 7 64bit

joby_toss
Posts: 1346
Joined: 22.07.2009, 19:19
Location: Romania
Contact:

Re: Find and delete empty folders?

#2 Post by joby_toss » 12.06.2015, 20:10

Search for "*" (no quotes) and use these settings (save as profile):

Image

Dirk
Posts: 187
Joined: 02.06.2010, 11:38

Re: Find and delete empty folders?

#3 Post by Dirk » 12.06.2015, 21:14

Many thanks, joby_toss,

This settings must be the right one:

Image
Image

I missed / disregard - sorry - to say to also find the empty sub folders of an empty folder (being not empty when containing a sub folder). So, how can FC find and remove all of the folders being empty or having a (sub) folder or more being empty?

How could I keep this path variable: Image
So, when I press CTRL+F the path of the active panel should be entered.

With these settings
Image
Image
FC finds this:
Image
Showing the folders with 0 Byte(s), but they aren't empty, each of them contains about 100 MB to 2 GB files. What am I missing?

Many thanks again.
FC newest stable version, portable
Win 7 64bit

joby_toss
Posts: 1346
Joined: 22.07.2009, 19:19
Location: Romania
Contact:

Re: Find and delete empty folders?

#4 Post by joby_toss » 13.06.2015, 09:44

Sorry, never went too deep into this option...

The easiest way to do it is by using a dedicated software, like this one:
http://www.portablefreeware.com/index.php?id=2165
or this one:
http://www.portablefreeware.com/index.php?id=2168

Marek
Author
Author
Posts: 2511
Joined: 10.04.2006, 07:48
Location: Germany
Contact:

Re: Find and delete empty folders?

#5 Post by Marek » 13.06.2015, 11:04

The size option in the search dialog is "File size" and not "Folder size" - it works for files only.

You can find empty folders as follow:
- switch view to details
- add new columns to the view: Files, Folders, Items
- restart the program
- go to the folder you want to search for empty subfolders
- switch the view to "Plain view - folders"
- each folder with the column Items=0 is empty (you can sort on the column)
- if you check the Files and Folders column you can find out which folders have no files or no subfolders

Dirk
Posts: 187
Joined: 02.06.2010, 11:38

Re: Find and delete empty folders?

#6 Post by Dirk » 13.06.2015, 20:49

Many thanks for the links, joby_toss.

Yes, the first program is already in use, but it's a bit sluggish and sometimes it uses about 300 MB of RAM or more. Very much for such a small program.

The second program I will try, thanks again.

Many thanks, Marek,

Done.

Hmmm, the column profile "empty folders" all the times automatically switches back to another profile (e.g. when I switch to plain folder view or back or a new file is added / deleted, I guess, I missed a setting).

Alright, a very nice approach, good to know, may be to search for empty folders and delete them a couple of times within half an hour or so there are too many clicks needed, but I can use it anyway.

Can FC automatically mark all of the folders having 0 items in them or a single sub folder only? Or mark all of the folders with a special amount of items / folders, e.g. more than 5 items (or folders) in a folder?

Many thanks again.
FC newest stable version, portable
Win 7 64bit

therealjd
Posts: 92
Joined: 09.09.2011, 15:48
Location: Canada

Re: Find and delete empty folders?

#7 Post by therealjd » 21.07.2015, 22:44

I made a bat file that does this for me.

delete-empty-directories.bat
with the following in the file

Code: Select all

for /f "usebackq delims=" %%d in (`"dir /ad/b/s | sort /R"`) do rd "%%d"
save the bat file to a location and then call up the bat file in your favorites
and use the %activedir% for the start folder

Image

It will scan the current directory and all subdirectories and deletes empty directories.
It works from the subfolder level and goes backwards, so it will also delete directories that only have other empty directories.

after the setup, it's one click, and it does it super quick!
FC XE 0.760 x86
Win 7 Ent 64bit SP1 |16 GB ram |Intel Core i7-3770
Win 10 Pro Anniversary | 4GB ram

Dirk
Posts: 187
Joined: 02.06.2010, 11:38

Re: Find and delete empty folders?

#8 Post by Dirk » 22.07.2015, 18:56

Many thanks, therealjd,

That sounds great.

I cannot get it to work, it looks like that:
http://i.imgur.com/UXbgh3h.png
http://i.imgur.com/o6g6goB.png

I start the bat, a black DOS box appears, but the folders are still there.
FC newest stable version, portable
Win 7 64bit

therealjd
Posts: 92
Joined: 09.09.2011, 15:48
Location: Canada

Re: Find and delete empty folders?

#9 Post by therealjd » 22.07.2015, 19:57

Dirk wrote:Many thanks, therealjd,

That sounds great.

I cannot get it to work, it looks like that:
http://i.imgur.com/UXbgh3h.png
http://i.imgur.com/o6g6goB.png

I start the bat, a black DOS box appears, but the folders are still there.
the syntax looks correct. What does the dos box show?

Also make sure hidden items are set to show, perhaps you have hidden files on those folders..
culprits can be things like thumbs.db, desktop.ini, etc
FC XE 0.760 x86
Win 7 Ent 64bit SP1 |16 GB ram |Intel Core i7-3770
Win 10 Pro Anniversary | 4GB ram

Dirk
Posts: 187
Joined: 02.06.2010, 11:38

Re: Find and delete empty folders?

#10 Post by Dirk » 22.07.2015, 20:43

the syntax looks correct. What does the dos box show?
I had tried a few times to recognize the text, but it runs to fast. Can I stop the scrolling?
Also make sure hidden items are set to show, perhaps you have hidden files on those folders..
Do you mean for testing or generally? Hmmm, could that mean, folders containing hidden items might be removed though not empty? The folders I created and used for testing do not contain any hidden item.
culprits can be things like thumbs.db, desktop.ini, etc
Ah, I see, you mean one could think a folder is empty although being not empty.

Alright, so it just does not work with me, so I will keep on using the old programs I have.

Many thanks anyway.
FC newest stable version, portable
Win 7 64bit

therealjd
Posts: 92
Joined: 09.09.2011, 15:48
Location: Canada

Re: Find and delete empty folders?

#11 Post by therealjd » 22.07.2015, 21:44

Dirk wrote:
the syntax looks correct. What does the dos box show?
I had tried a few times to recognize the text, but it runs to fast. Can I stop the scrolling?
you can add a second line to the bat file

Code: Select all

for /f "usebackq delims=" %%d in (`"dir /ad/b/s | sort /R"`) do rd "%%d"
pause
that will keep the dos box open to see what's going on.

Ahh! noticed something.. your variable in FC XE is wrong..
your variable has an "e". i select the variable from the button, so there's no mistake for spelling.
Basically, it's been running the command, but searching in your "I:\programme" directory the whole time

Image
Last edited by therealjd on 22.07.2015, 22:02, edited 1 time in total.
FC XE 0.760 x86
Win 7 Ent 64bit SP1 |16 GB ram |Intel Core i7-3770
Win 10 Pro Anniversary | 4GB ram

Dirk
Posts: 187
Joined: 02.06.2010, 11:38

Re: Find and delete empty folders?

#12 Post by Dirk » 22.07.2015, 22:02

Oops, the empty folders obviously are searched (and removed) at another place. It appears something like that can end very inconveniently, say somehow disastrously.

Code: Select all

I:\FreeCommander>rd "I:\FreeCommander\Data\Temp\Lingoes\Translator\2.9.2-us_20150717122850\d
ict\temp\25D62D261B9B6943BE86B7DCF8F9D255"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\Temp\Lingoes\Translator\2.9.2-us_20150717122850\d
ict\temp\0980C64697D4904A81066E9F58F9B8AD"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\Temp\Lingoes\Translator\2.9.2-us_20150717122850\d
ict\temp"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\Temp\Lingoes\Translator\2.9.2-us_20150717122850\d
ict"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\Temp\Lingoes\Translator\2.9.2-us_20150717122850"

Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\Temp\Lingoes\Translator"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\Temp\Lingoes"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\Temp\jna--1664858691"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\Temp\hsperfdata_Biffilius"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\Temp\$$$$$_sWeather_temp"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\Temp"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\FileContainers"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-07-22 09-55-39"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-07-20 11-10-44"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-07-19 22-16-05"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-07-19 22-16-04"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-07-18 22-26-27"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-07-17 10-54-18"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-07-15 13-56-56"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-07-12 10-18-32"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-06-29 09-58-39"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-06-28 20-48-14"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-06-25 08-49-01"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-06-22 00-28-07"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-06-21 12-47-11"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-06-20 08-16-37"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-06-19 00-41-27"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-06-16 14-52-53"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-06-15 01-07-44"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-06-14 20-00-14"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-06-13 14-15-35"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-06-11 22-12-27"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-06-11 19-14-37"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-06-10 20-47-17"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-06-07 00-59-52"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-06-01 10-51-25"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-05-31 01-33-14"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-05-29 09-37-15"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-05-28 13-12-43"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-05-26 01-05-45"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-05-24 13-09-43"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-05-23 22-20-22"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-05-22 21-16-01"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-05-21 08-38-52"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-05-20 14-13-26"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-05-19 14-01-30"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-05-18 15-54-50"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-05-17 20-28-24"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-05-16 18-20-04"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-05-15 13-19-17"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-05-12 20-30-28"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-05-10 11-50-18"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-05-09 11-38-58"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-05-08 22-29-14"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-05-06 15-20-08"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-05-05 13-50-22"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-05-02 09-38-53"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-05-01 13-57-38"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-04-30 11-42-12"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-04-28 19-29-56"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-04-27 20-40-32"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-04-25 20-51-17"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings\Bkp_Settings_2015-04-24 22-27-22"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\settings"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data\comInstaller"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\Data"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\App\FreeCommanderXE\LNG"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\App\FreeCommanderXE"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\App\DefaultData\settings"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\App\DefaultData"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\App\AppInfo\Launcher"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\App\AppInfo"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>rd "I:\FreeCommander\App"
Das Verzeichnis ist nicht leer.

I:\FreeCommander>pause
Drücken Sie eine beliebige Taste . . .
FC newest stable version, portable
Win 7 64bit

therealjd
Posts: 92
Joined: 09.09.2011, 15:48
Location: Canada

Re: Find and delete empty folders?

#13 Post by therealjd » 22.07.2015, 22:24

well the reality is the command will still only remove empty directories.. so shouldn't mess with anything critical. :wink:

did you correct the %ActivDir% variable?
FC XE 0.760 x86
Win 7 Ent 64bit SP1 |16 GB ram |Intel Core i7-3770
Win 10 Pro Anniversary | 4GB ram

Dirk
Posts: 187
Joined: 02.06.2010, 11:38

Re: Find and delete empty folders?

#14 Post by Dirk » 22.07.2015, 22:37

well the reality is the command will still only remove empty directories.. so shouldn't mess with anything critical.
Well, yes, well, well, it should....and may be empty directories are needed at other places...
did you correct the %ActivDir% variable?
I didn't even know there was anything to be corrected.
FC newest stable version, portable
Win 7 64bit

therealjd
Posts: 92
Joined: 09.09.2011, 15:48
Location: Canada

Re: Find and delete empty folders?

#15 Post by therealjd » 22.07.2015, 22:49

Dirk wrote:
well the reality is the command will still only remove empty directories.. so shouldn't mess with anything critical.
Well, yes, well, well, it should....and may be empty directories are needed at other places...
did you correct the %ActivDir% variable?
I didn't even know there was anything to be corrected.
I edited my last post.. (refresh the page?)

That explains why the bat file was not running on the active pane.

%activedir% should be %ActivDir%
FC XE 0.760 x86
Win 7 Ent 64bit SP1 |16 GB ram |Intel Core i7-3770
Win 10 Pro Anniversary | 4GB ram

Post Reply

Who is online

Users browsing this forum: No registered users and 34 guests