Wednesday, January 25, 2017

Find files with specific extensions in current directory

Find files with specific extensions in current directory (you can add multiple extensions as per syntax

find . -type f \( -name "*.sh" -o -name "*.txt" \)
find /home/bhsingh/ -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.deb" -o -name ".pdf" \)

Find file & redirec the result to a file

find /home/www/html -type f \( -name "*.php"\) -print0 | xargs -0 stat --format '%Z :%z %n' | sort -nr > /home/bhsingh/php_files.txt
find / -type f -print0 | xargs -0 stat --format '%Z :%z %n' | sort -nr > /root/all_files.txt

No comments:

Post a Comment