In a directory, "my_directory", which has other directories in it, of multiple level of nesting, there're some files that I want to find by pattern and then, one by one, upload them to a remote server. On a remote server they should be copied over to the same path relative to the remote my_directory
. For that, I'll scp
I've started off with this:
ls -al my_directory | grep "*.my_custom."
and it's returned nothing, although the files with *.my_custom.
part in them exist.
How can I:
a) find those files, by a pattern
b) enumerate them in a loop, in bash, so I can refer to each as a variable? In order to upload it to a server as a next step.