Comments on: PowerShell: Delete Files Smaller than 10MB http://www.terminally-incoherent.com/blog/2012/06/27/powershell-delete-files-smaller-than-10mb/ I will not fix your computer. Tue, 04 Aug 2020 22:34:33 +0000 hourly 1 https://wordpress.org/?v=4.7.26 By: Ignacio Calvo http://www.terminally-incoherent.com/blog/2012/06/27/powershell-delete-files-smaller-than-10mb/#comment-255104 Sun, 19 Apr 2015 17:30:04 +0000 http://www.terminally-incoherent.com/blog/?p=12276#comment-255104

You stopped short of using all the available default aliases:

ls | ? {$_.Length -lt 10mb} | del

Also, doing it recursively is 3 more chars:

ls -r | ? {$_.Length -lt 10mb} | del

Reply  |  Quote
]]>
By: astine http://www.terminally-incoherent.com/blog/2012/06/27/powershell-delete-files-smaller-than-10mb/#comment-22512 Thu, 28 Jun 2012 14:53:52 +0000 http://www.terminally-incoherent.com/blog/?p=12276#comment-22512

“why didn’t you just order the files by size in Explorer and hit delete”

Probably would have been slower anyway. Explorer’s search/sort functionality is a bear to work with and this way you have to wait twice rather than once.

I’ve done this kind of work before as well. I reconcile 20TiB of video files, including backups, backups of backups, and incremental work files. I wrote a lisp programs which hashed the files to determine uniqueness and grouped them based on tag and path information. I was able to quarter the filespace to be archived. They went ahead and archived the whole damn thing anyway. Librarians…

Reply  |  Quote
]]>
By: Mats Rauhala http://www.terminally-incoherent.com/blog/2012/06/27/powershell-delete-files-smaller-than-10mb/#comment-22510 Thu, 28 Jun 2012 08:23:02 +0000 http://www.terminally-incoherent.com/blog/?p=12276#comment-22510

I was once asked to recover files from a failed drive. They had managed to use some sort of autorecovery tool, but it not only cleared the folder structure like yours, but also cleared the filenames. Every single file had a hash-like name, and they were in the same directory.

I wrote a script that tries to guess the file type ($(file)), creates new directories for the filetypes (“/images”), and writes a ‘better’ name and an extension (“/images/image_001.jpg”) so that the owners could open the files without guessing the filetypes themselves.

Reply  |  Quote
]]>
By: Luke Maciak http://www.terminally-incoherent.com/blog/2012/06/27/powershell-delete-files-smaller-than-10mb/#comment-22508 Thu, 28 Jun 2012 05:39:57 +0000 http://www.terminally-incoherent.com/blog/?p=12276#comment-22508

@ Chris Wellons:

That’s actually an excellent point. I didn’t think about that, but yeah – if you don’t want to back something up, it is good idea to keep an up-to-date file index just so that in an event of a catastrophic data failure you know what you have lost.

Reply  |  Quote
]]>
By: Chris Wellons http://www.terminally-incoherent.com/blog/2012/06/27/powershell-delete-files-smaller-than-10mb/#comment-22507 Thu, 28 Jun 2012 02:38:26 +0000 http://www.terminally-incoherent.com/blog/?p=12276#comment-22507

You could say that while all the file data on the drive was easily replaceable, there was still some important, hard-to-replace data on the drive: the file listing. It’s like losing all your bookmarks. The data is all out there but you lost the directions to get to it.

This information could be captured and backed up with a simple “find /mnt/archive > listing.txt“.

Reply  |  Quote
]]>