so whenever I put a directory as my first argument, I want my program to grab all the jpg files and sort them in the order they are created. I have more than one sub-directories so I need the process to be done recursively. Here's what I tried
#!/bin/bash
file = "$1"
find $1 -name '*.jpg'
sor...
really not sure how to approach...any help would be appreciated
You give a path and file type,this code find :) You can save as FindFileScript.sh
#!/bin/bash
echo -n "Which directory should I search ? (/Desktop) : "
read directory
echo -n "Select file type(like png || jpg || pdf) : "
read fileType
find "$directory" -type f -name "*.$fileType"
./FindFileScript.sh
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.