[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Check if file size greater than a small number?
From: |
Alex fxmbsw7 Ratchev |
Subject: |
Re: Check if file size greater than a small number? |
Date: |
Thu, 10 Mar 2022 03:02:57 +0100 |
mkdir ttt
cd ttt
>0 ; printf 1 >1 ; printf 22 >22 ; printf 333 >3
minsize() { < <( LC_ALL=C find "${@:2}" -maxdepth 0 -printf %s\\n ) gawk
-v min=$1 'BEGIN { while ( getline <"/dev/stdin" ) if ( ++i && $0 <= min )
print ARGV[i] ; exit }' "${@:2}" ; }
minsize 2 *
>>>
0
1
2
On Wed, Mar 9, 2022 at 6:10 PM Peng Yu <pengyu.ut@gmail.com> wrote:
>
>
https://stackoverflow.com/questions/5920333/how-can-i-check-the-size-of-a-file-using-bash
>
> I see things like the above that call an external program or cat all
> the file content to check the size of a file.
>
> But if my goal is just to know whether the file size is greater than a
> smaller (say 40). What is the most efficient way to do so in bash?
>
> --
> Regards,
> Peng
- Re: Check if file size greater than a small number?, (continued)
- Re: Check if file size greater than a small number?, Jesse Hathaway, 2022/03/09
- Re: Check if file size greater than a small number?, Kerin Millar, 2022/03/09
- Re: Check if file size greater than a small number?, Peng Yu, 2022/03/09
- Re: Check if file size greater than a small number?, Alex fxmbsw7 Ratchev, 2022/03/10
- Re: Check if file size greater than a small number?, Chet Ramey, 2022/03/10
- Re: Check if file size greater than a small number?, Jesse Hathaway, 2022/03/10
- Re: Check if file size greater than a small number?, Greg Wooledge, 2022/03/10
- Re: Check if file size greater than a small number?, Lawrence Velázquez, 2022/03/10
Re: Check if file size greater than a small number?,
Alex fxmbsw7 Ratchev <=
Re: Check if file size greater than a small number?, Kerin Millar, 2022/03/09