Imagine that I have the directory as below:
dir
|
|--- sub1
| |
| |------filea.jpg
| |------fileb.jpg
|
|
|--- sub2
|
|------filec.jpg
|------filed.jpg
|------sub21
|
|-------filee.jpg
What I need to do is to pass all of files which are located in the same directory as one parameter to some executable file.
For example, for the case above, I need to:
upload.sh dir/sub1/filea.jpg dir/sub1/fileb.jpg
upload.sh dir/sub2/filec.jpg dir/sub2/filed.jpg
upload.sh dir/sub2/sub21/filee.jpg
I'm not good at linux shell, what I have done is to list all of them with the script:
find dir -type f | while read myfile; do
echo $myfile
done;
How to make a script for my need?