Article 4QVBV [SOLVED] specify which files rsync should fetch

[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:
1112223334_18BEwW4data
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:
echo "Enter the week number you want to get."
read week
wW4
echo $week
wW4
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}"latest?d=yIl2AUoC8zA latest?i=BODXxdOaed0:7S8anY-BUOc:F7zBnMy latest?i=BODXxdOaed0:7S8anY-BUOc:V_sGLiP latest?d=qj6IDK7rITs latest?i=BODXxdOaed0:7S8anY-BUOc:gIN9vFwBODXxdOaed0
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments