0

How to copy files from source

/backup/cpbackup/daily/a1/public_html/index.html
/backup/cpbackup/daily/b2/public_html/index.html
/backup/cpbackup/daily/c3/public_html/index.html
/backup/cpbackup/daily/d4/public_html/index.html
/backup/cpbackup/daily/e5/public_html/index.html
/backup/cpbackup/daily/f6/public_html/index.html

to destination

/home/a1/public_html/index.html
/home/b2/public_html/index.html
/home/c3/public_html/index.html
/home/c4/public_html/index.html
/home/e5/public_html/index.html
/home/f6/public_html/index.html

2 Answers 2

0

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/
2
  • 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
1

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/
done

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.