Page 1 of 1

Report Empty Folders and Zero-Sized Files.

Posted: 17 Oct 2010 01:05
by SkyFrontier
Based on this thread/code, I made this one to report empty folders and files with size=0.
v2 (below):
-ends with all zero/empty files/folders selected and ready to manual nuke.
-now it reports empty and zero-sized folders, too!
-easier to read and understand.

Code: Select all

//Report Empty Folders and Zero-Sized Files, v2
   #263;//all items on a branch
   #487;//Get Folder sizes

   sortby "path", "a"; //alternate version: sortby "size", "a";

   selfilter "Empty", d, "size";// Select empty folders
   focus;//Without this only one focused item is returned
   $folders = get("SelectedItemsPathNames", "<crlf>"); //copy full path/names

   selfilter "0", d, "size";// Select folders with size = 0
   focus;//Without this only one focused item is returned
   $folders0 = get("SelectedItemsPathNames", "<crlf>"); //copy full path/names

   selfilter "0", f, "size";// Select empty files/files with size = 0
   focus;//Without this only one focused item is returned
   $files = get("SelectedItemsPathNames", "<crlf>"); //copy full path/names

   $report = "Empty Folders: <crlf>$folders <crlf><crlf>Folders with Size = 0 (zero): <crlf>$folders0 <crlf><crlf>Files with Size = 0 (zero): <crlf>$files <crlf><crlf>Have a nice day! ^^";
//   sel;//cosmetic: de-select/unselect all

   selfilter "0", f, "size";
   selfilter "Empty", d, "size", 1;
   selfilter "0", d, "size", 1;

   copytext $report;
   status "Path/Names paste into clipboard!";
   text $report;
v1 (inconsistent):

Code: Select all

//Report Empty Folders and Zero-Sized Files
   #263;//all items on a branch
   #487;//Get Folder sizes
   sortby "path", "a"; //alternate version: sortby "size", "a";
   selfilter "Empty", d, "size";// Select empty folders
   focus;//Without this only one focused item is returned
   $folders = get("SelectedItemsPathNames", "<crlf>"); //copy full path/names
   selfilter "0", f, "size";// Select empty files
   focus;//Without this only one focused item is returned
   $files = get("SelectedItemsPathNames", "<crlf>"); //copy full path/names
   $report = "Empty Folders: <crlf>$folders <crlf><crlf>Files with Size = 0 (zero): <crlf>$files <crlf><crlf>Have a nice day! ^^";
   sel;//cosmetic: de-select/unselect all
   copytext $report;
   status "Path/Names paste into clipboard!";
   text $report;

Re: Report Empty Folders and Zero-Sized Files.

Posted: 16 Sep 2019 13:13
by chumbo
Sorry, I'm not very techy....how do I use this?

I'm in fact trying to find all my empty folders because recently I've been finding folders that are empty when they shouldn't have been! The files just disappeared so this got me scared and wondering how many other empty folders and lost files I may have!? :veryconfused:

Any idea how and why that might happen in fact?

Re: Report Empty Folders and Zero-Sized Files.

Posted: 16 Sep 2019 13:19
by highend
Outdated...

Go into the root from which all empty folders should be found and execute this:

Code: Select all

    $folders = quicksearch("/ed", , , "s");
    if ($folders) { tab("new"); paperfolder("Empty_folders", $folders); }

Re: Report Empty Folders and Zero-Sized Files.

Posted: 16 Sep 2019 13:28
by chumbo
Great, thanks!
(although I since figured out I could simply do it using a few filters with the 'Find Files'!)