[SOLVED] specify which files rsync should fetch
by Pedroski from LinuxQuestions.org on (#4QVBV)
Thanks to help from here, thanks again for that, I can use rsync to fetch my files:
Code:# get files from RemotePath to my local machine
rsync -av --progress --remove-source-files -e 'ssh -i ~/.ssh/godaddy5_rsa' $user@$server:${RemotePath}/ "${Answers}"These are very small text files written by a php script. They all have names like this:
Quote:
Where the number is a 10 digit student number like 1112223334, 18BE is the class and wW4 is winter Week 4
To save backing the files up, I want to get rid of --remove-source-files
I would like to get my bash script to read in wW4 or wW5 as a variable, then tell rysnc to only get files with that variable in the name.
Quote:
This gets the week number.
How do I tell rsync to only get files with file names containing $week (=wW4 in this case)?
Solved it with some help from stackexchange:
Code:rsync -av --progress -e 'ssh -i ~/.ssh/godaddy5_rsa' $user@$server:${path2}/*$week* "${Answers}"
Code:# get files from RemotePath to my local machine
rsync -av --progress --remove-source-files -e 'ssh -i ~/.ssh/godaddy5_rsa' $user@$server:${RemotePath}/ "${Answers}"These are very small text files written by a php script. They all have names like this:
Quote:
1112223334_18BEwW4data |
To save backing the files up, I want to get rid of --remove-source-files
I would like to get my bash script to read in wW4 or wW5 as a variable, then tell rysnc to only get files with that variable in the name.
Quote:
echo "Enter the week number you want to get." read week wW4 echo $week wW4 |
How do I tell rsync to only get files with file names containing $week (=wW4 in this case)?
Solved it with some help from stackexchange:
Code:rsync -av --progress -e 'ssh -i ~/.ssh/godaddy5_rsa' $user@$server:${path2}/*$week* "${Answers}"