Delete empty folders

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
oko
Senior Member
Senior Member
Posts: 201
Joined: 2007-05-03, 16:22 UTC

Delete empty folders

Post by *oko »

(my opinion, experiences, advice, feature request)

Sometimes there are some empty folders on the disc. Many empty folders occurs for example after "Synchronize" even if "Empty folders" is ticked. If they are unwanted it is not so simple to delete them without risk of deleting something unwanted.

If you want delete empty folders, you must find out if folder contains files. If count of files=0, folder may be deleted. TC is able to find out count of files in folder and shows it in Ctrl+Q window for example, but does not provide count of files neither for searching nor for coloring by type. For now solution is plugin DirSizeCalc which is able to provide count of files in folder as criteria for searching.

Problem of deleting empty folders is that it must be set in more steps and in addition it must be proceeded multiple times. It would be usefull to have one-click function in TC for deleting empty folders. User would not have to go through more steps or install external solutions to do that job. I have posted feature request here:
https://www.ghisler.ch/board/viewtopic.php?t=76691

You can determine empty folder in TC by one of the following:
a) by entering folder - you must enter folder and all its subfolders if they are empty. Risk: you could delete hidden files by mistake if they are not visible.
b) by counting folder size (Alt+Shift+Enter) - Folder with zero size can be empty or not. It can contain subfolders or files with zero size. Risk: you could delete zero-size files by mistake.
c) using branch view on the folder (Ctrl+B) - if no files are displayed in recursive view, folder can be considered empty. Risk: you could delete hidden files by mistake if they are not visible.
d) using Ctrl+Q view, where TC shows size and number of files.
e) with special plugin - you must have installed plugin which counts files in folders, eventually you can create column view in window to see that information.
f) by properties of folder (rightclick context menu), where size and number of files are shown in properties window.

If you have more folders to check if they are empty and you want to delete them, an automation is more reliable and saves time than going through folders manually. There are couple of external software specialized in it, but I like to stay in TC. For me for now the best method of deleting more empty folders in TC is with search+dirsizecalc method. It is quick, simple, reliable, careful, although more steps are needed:

(The DirSizeCalc plugin must be installed)
1. Search (Alt+F7 or Alt+Shift+F7).
2. Click Plugins tab and set criteria: dirsizecalc |contains files | = | No
Criteria ensures, that only folders not files will be proceeded and no files (nor zero-sized files) will be deleted. The folders and subfolders where files are will be preserved (it means also paths of files will be preserved).
3. Click "Start search".
4. After search finishes, click "Feed to listbox".
5. In window with folders select all (Ctrl+A) and delete them (Del).
6. If message appears that folder is not empty, click "All" to delete to all. Do not worry because "not empty" means due to criteria set, that folder going to be deleted contains only subfolders and no files.
7. Repeat steps (from 1.) to check if there are another empty folders (see below why).

For deleting empty folders in general there is some complication due to descript.ion files bounded with folders (ion files).
If you have some ion files they cause that some folders (in structure above them) are not deleted. It is logical because ion files are files and method mentioned above must not delete folders with files in it. Ion files are deleted together with folder beside. Folders in which ion files were, become empty after deleting. Therefore next searching will find another empty folders. There could be multiple searching and deleting needed till search gives no results.

- - -
Similar forum topics:
https://www.ghisler.ch/board/viewtopic.php?p=280064#p280064
https://www.ghisler.ch/board/viewtopic.php?p=337717&hilit=how+to+delete+empty+folders#p337717
Troy_Daniel
Junior Member
Junior Member
Posts: 14
Joined: 2021-04-30, 14:14 UTC

Re: Delete empty folders

Post by *Troy_Daniel »

With the help of the commandline tool Delete Empty (http://www.intelliadmin.com/DelEmpty.exe) from http://www.intelliadmin.com/index.php/downloads/, you can just make a custom command from it. For example,

Code: Select all

[em_DeleteEmptyDir]
cmd=delempty -d -y -s
param="%P"
menu=Delete empty directory from source path

Another way is to use the everything, with the option

Code: Select all

empty:
. Hope it helps.
Anselm
Junior Member
Junior Member
Posts: 31
Joined: 2013-09-17, 17:06 UTC

Re: Delete empty folders

Post by *Anselm »

Troy_Daniel wrote: 2022-05-25, 08:32 UTC With the help of the commandline tool Delete Empty (http://www.intelliadmin.com/DelEmpty.exe) from http://www.intelliadmin.com/index.php/downloads/, you can just make a custom command from it. For example,

Code: Select all

[em_DeleteEmptyDir]
cmd=delempty -d -y -s
param="%P"
menu=Delete empty directory from source path

Another way is to use the everything, with the option

Code: Select all

empty:
. Hope it helps.
nice tool, but i can not deal with long pathes:

Fatal Error. Max Path Exceeded:
Troy_Daniel
Junior Member
Junior Member
Posts: 14
Joined: 2021-04-30, 14:14 UTC

Re: Delete empty folders

Post by *Troy_Daniel »

Fatal Error. Max Path Exceeded:
Well, Windows itself cannot deal with the files/folders exceed the max length. So, the only way I can find now, is to use everything to locate the folders in TC, and then delete it with TC.
Post Reply