Operating System - HP-UX
1821985 Members
3437 Online
109638 Solutions
New Discussion

copy all files and dirs including hidden ones

 
loy4lplay
Occasional Advisor

copy all files and dirs including hidden ones

Hello,

 

I would like to copy all files and dirs (includding hidden files) on a HP-UX 11.31 box, what would be the right command since cp -pR does not copy them all?

 

Thanks

 

 

P.S. This thread has been moved from General to HP-UX > languages. - Hp Forum Moderator

1 REPLY 1
Bill Hassell
Honored Contributor

Re: copy all files and dirs including hidden ones

>> since cp -pR does not copy them all?

 

cp will copy what you tell it to copy.

However, if you are using * as a way to specify files and directories, you need to read about Filename Generation and Pattern Matching in your shell manual. The * character will not match any file or directory that starts with the . (period or dot character). If you need to copy everything in a directory, don't use * but instead use . which means "everything in this current directory", like this:

 

# cd /tmp/olddir
# cp -rp . /var/tmp/newdir

 Or better yet, just specify the directory to be copied:

 

# cp -rp /tmp/olddir /var/tmp

 

 

And the directory olddir will be compleely copied to /var/tmp.



Bill Hassell, sysadmin