1 Answers
Shell Scripting: Finding Files with Specific Extension
One way to find all files with a specific extension in a directory and its subdirectories is by using the following shell script:
#!/bin/bash # Script to find all files with specific extension in a directory and its subdirectories echo "Enter the directory path:" read directory echo "Enter the specific file extension (e.g. .txt, .jpg):" read extension find "$directory" -type f -name "*$extension"
Save this script in a file, give it executable permissions, and run it in your terminal to find all files with the specified extension in the directory and its subdirectories.
Please login or Register to submit your answer