How to copy files from source


to destination


2 Answers 2


Another way to do it (assuming you're trying to copy all the files over):

rsync -a /backup/cpbackup/daily/user* /home/

If you want just index.html and nothing else:

rsync -av --include=*/ --include=*public_html/index.html --exclude=* /backup/cpbackup/daily/user* /home/
  • the user not like user 1 and user 2 , it's example , i mention usernames like jogn and smith not all have the same user name folder
    – iLinux85
    Oct 2, 2013 at 21:53
  • Then substitute * for user* rsync -a /backup/cpbackup/daily/* /home/
    – user143703
    Oct 2, 2013 at 21:53

This would be one way to do it:

for user in user1 user2 user3 user4 user5 user6; do
  cp /backup/cpbackup/daily/$user/public_html/index.html /home/$user/public_html/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.