Discussion of programming on Linux, including shell scripting, perl, python, c/c++, mono, java. Whatever tickles your fancy.
7 posts • Page 1 of 1
azfar wrote:Is there any way to delete bunch of files from a particular directory whose size is larger, smaller or similler to my given value.
oh, you want the code for that. here's a one-liner to print files larger than 3,000,000 bytes:
Code: Select all
ls -1 | perl -nle 'chomp; print if (-f $_ && (stat($_)) > 3000000);'
if you want to delete the files instead of printing them, change "print" to "unlink".
Who is online
Users browsing this forum: No registered users and 1 guest