Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
share|improve this question
add comment

2 Answers

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
share|improve this answer
add comment

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/
share|improve this answer
    
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 '13 at 21:53
    
Then substitute * for user* rsync -a /backup/cpbackup/daily/* /home/ –  yoonix Oct 2 '13 at 21:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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