Skip to main content
Using find command to delete file with certain size

If you're having problem distinguishing suspected incomplete file with the complete ones, you may use find command on Linux command line. Assume here, complete file is 300M above... as you can see below, there are JPG files which are also unneeded:

# ls -lh
jumlah 2.1G
-rw-r--r-- 1 najmi najmi 350M 2009-08-07 13:34 House MD.2x01.Acceptance Internal.avi
-rw-r--r-- 1 najmi najmi 16K 2009-08-07 13:22 House MD.2x01.Acceptance Internal.avi.jpg
-rw-r--r-- 1 najmi najmi 350M 2009-08-07 13:34 House MD.2x02.Autopsy.avi
-rw-r--r-- 1 najmi najmi 24K 2009-08-07 13:22 House MD.2x02.Autopsy.avi.jpg
-rw-r--r-- 1 najmi najmi 350M 2009-08-07 13:34 House MD.2x03.Humpty Dumpty.avi
-rw-r--r-- 1 najmi najmi 30K 2009-08-07 13:22 House MD.2x03.Humpty Dumpty.avi.jpg
-rw-r--r-- 1 najmi najmi 350M 2009-08-07 13:34 House MD.2x04.TB Or Not TB.avi
-rw-r--r-- 1 najmi najmi 34K 2009-08-07 13:22 House MD.2x04.TB Or Not TB.avi.jpg
-rw-r--r-- 1 najmi najmi 350M 2009-08-07 13:34 House MD.2x05.Daddy's Boy.avi
-rw-r--r-- 1 najmi najmi 20K 2009-08-07 13:22 House MD.2x05.Daddy's Boy.avi.jpg
-rw-r--r-- 1 najmi najmi 351M 2009-08-07 13:34 House MD.2x06.Spin.avi
-rw-r--r-- 1 najmi najmi 21K 2009-08-07 13:22 House MD.2x06.Spin.avi.jpg
-rw-r--r-- 1 najmi najmi 21K 2009-08-07 13:22 House MD.2x08.The Mistake.avi.jpg
-rw------- 1 root root 9.2M 2009-08-07 13:23 House MD.2x09.Deception.avi
-rw-r--r-- 1 najmi najmi 9.7M 2009-08-07 13:23 House MD.2x10.Failure To Communicate.avi
-rw-r--r-- 1 najmi najmi 24M 2009-08-07 13:56 House MD.2x11.Need To Know.avi


-Use find for sanity check.. listing .. and you can cross-check with the above list output


# find . -type f -size -300M
./House MD.2x02.Autopsy.avi.jpg
./House MD.2x10.Failure To Communicate.avi
./House MD.2x11.Need To Know.avi
./House MD.2x01.Acceptance Internal.avi.jpg
./House MD.2x05.Daddy's Boy.avi.jpg
./House MD.2x06.Spin.avi.jpg
./House MD.2x03.Humpty Dumpty.avi.jpg
./House MD.2x09.Deception.avi
./House MD.2x04.TB Or Not TB.avi.jpg
./House MD.2x08.The Mistake.avi.jpg

Delete with -exec flag
# find . -type f -size -300M -exec rm {} \;

Done!!!
# ls -lh
jumlah 2.1G
-rw-r--r-- 1 najmi najmi 350M 2009-08-07 13:34 House MD.2x01.Acceptance Internal.avi
-rw-r--r-- 1 najmi najmi 350M 2009-08-07 13:34 House MD.2x02.Autopsy.avi
-rw-r--r-- 1 najmi najmi 350M 2009-08-07 13:34 House MD.2x03.Humpty Dumpty.avi
-rw-r--r-- 1 najmi najmi 350M 2009-08-07 13:34 House MD.2x04.TB Or Not TB.avi
-rw-r--r-- 1 najmi najmi 350M 2009-08-07 13:34 House MD.2x05.Daddy's Boy.avi
-rw-r--r-- 1 najmi najmi 351M 2009-08-07 13:34 House MD.2x06.Spin.avi

Comments

Popular posts from this blog

Gue dengan S2 gue. Sronok banget!
Danga Bay, Chevrolet Optra and bio...(eh?) I thought it was Debian(haha). My colleague point me to the AirAsia flight turbin and he told me, "Macam debian punya logo" I saw a spiral on top the turbin blades. Pretty much like Debian Logo That's spark me to shoot for a pix. And I was warned by the airport staff. Uh,uh. Flash lamp will spark burst,eh? I was presented my "mock" research proposal. Suggested "Profiling Bioinformatics Application Behavior on Distributed Computing Architecture". Eh, will this gonna be bioinformatics specific or hardware optimization specific.or? Flashback: I spent almost a week at the office. When it's Subh azan,went back to my house for bath and pray. Reading all the journals and papers was not funny,really. Tough eye balls. No world cup. Ewh. And have some VCD lure. Uh,uh. you gonna be kidding. Anyway, I learned a lot and UTM SLAB Research Course is no joke. Really. My proposal has been corrected with comments so I have