Print all files in sorting order and size limit coderinme
Suppose there is a folder containing numerals files and sun folders. All these files and sub folders may vary in their size depending upon the content. So let us now print all files having greater than 100 kb and in sorting order. In any folder there are some files, so we need to find and also display the names of all those files whose size is greater than 100 KB. After doing this, we also need to sort all those files into an ascending order.
#!/bin/bash if [ $# -lt 1 ]; then echo "Usage: $0 dir" exit 1 fi if [ -d $1 ]; then find $1 -maxdepth 1 -size +100c -type f -printf "%s\t%p\n" | sort -nr fi
for more Linux questiom
This question is found in every assignment of bash and shell.
All rights reserved. No part of this Post may be copied, distributed, or transmitted in any form or by any means, without the prior written permission of the website admin, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to the owner, addressed “Attention: Permissions Coordinator,” to the admin @coderinme