ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Finished Programs

DONE: In sub-folders, delete all files except the largest

(1/3) > >>

nkormanik:
Given a folder, XYZ.  Look in sub-folders.  If more than one file exists within any one sub-folder, delete all except the largest file present.

Issue has arisen from capturing streaming audio 'radio stations' around the Internet.

One folder has 22 different copies of Queen's Radio Ga Ga.  Another, 20 copies of Madona's Like A Prayer. 18 MJ's Billie Jean.  And on and on.

Need a way to pare out the littler ones, I suppose.  Not the very best solution, because there is often announcer voice at the beginning of the longer items -- that's actually why they are longer.  But, keeping the longest/biggest seems the best bet I can think of.

Question is, how does one do this?

Hundreds of sub-folders, by the way.  So need an auto way.

Thanks!

Nicholas Kormanik

KodeZwerg:
How about a safer reverse way, automatic copy biggest file inside sub-folder to new location, if you afterwards wish, delete that source folder.

nkormanik:
Wow!  Outstanding thinking, KodeZwerg.

Now, how to go about doing THAT?

Perhaps copy to XYZ_Biggest....

highend01:
Try the attached file (with some testdata folders first!)

VT: https://www.virustotal.com/en/file/8975331ed8f78de1281e063b94501ca4e088574f07963c542e3b4b70398277ab/analysis/1534240206/

Works fine here...

anandcoral:
Hi Nicholas,

highend01 already gave to solution. Still I have attached two batch files I use to "delete all but latest 6 zip files in all subdirectories", i.e. instead of size it checks date. Since they are batch files, you may modify them as per your requirement.

Regards,

Anand

Navigation

[0] Message Index

[#] Next page

Go to full version