Report Empty Folders and Zero-Sized Files.

Discuss and share scripts and script files...
Post Reply
SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Report Empty Folders and Zero-Sized Files.

Post 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;
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

chumbo
Posts: 243
Joined: 04 Jan 2015 15:20

Re: Report Empty Folders and Zero-Sized Files.

Post 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?

highend
Posts: 13275
Joined: 06 Feb 2011 00:33

Re: Report Empty Folders and Zero-Sized Files.

Post 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); }
One of my scripts helped you out? Please donate via Paypal

chumbo
Posts: 243
Joined: 04 Jan 2015 15:20

Re: Report Empty Folders and Zero-Sized Files.

Post by chumbo »

Great, thanks!
(although I since figured out I could simply do it using a few filters with the 'Find Files'!)

Post Reply