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