Tag Info

Hot answers tagged


-size with a suffix of b is for 512-byte blocks, not bytes. 5000000b is 2,560,000,000 bytes or 2.5 GB Try: find /home -size +5M -name "error_log" -exec rm -rf {} \; From the GNU find man page: -size n[cwbkMG] File uses n units of space. The following suffixes can be used: `b' for 512-byte blocks (this is the default if no suffix is ...


Giving the flag -maxdepth 1 you are telling it to look only in the /export/home1/ directory, not in the subtrees. I would just remove the -maxdepth (and -mindepth) flag if not necessary for other reasons.


You could use awk, exit on line 3 (the END rule is still executed) and exit 1 in the END block if no. of lines is not 2 e.g. with zsh: print -rl -- *(.e_'awk "NR==3{exit}END{if(NR!=2){exit 1}}" $REPLY'_) will list two-line files in the current directory; replace print -rl with mv and add the destination if you want to move them. With other shells: for ...


If you are using GNU find, this should work for you find . -regextype sed -regex "./test[0-9]\{2\}.txt" Explanation -regextype sed - use basic posix regular expression (just because thats what Im familiar with) ./ - necessary because find considers all file paths on a relative search to begin with this pattern [0-9]\{2\} - 2 instances of the [0-9] ...


Try this: { echo To: my_email@domain.com echo From: from_email@example.com echo Subject: mov files greater than 1M echo find /path/to/folder/ -type f -size +1M -name "*.mov" } | ssmtp my_email@domain.com You don't need the printf on find.


After much searching on IRC someone pointed me to the following answer find . -iname "*.xml" -exec bash -c 'echo "$1"' _ {} \; or for my example (with the string cut removed to save confusion) find . -iname "*.xml" -exec bash -c 'gmake NAME="$1"' _ {} \; The way this works is bash takes the parameters after -c as arguments, _ {} is needed so that the ...

Only top voted, non community-wiki answers of a minimum length are eligible