Register
It is currently Fri Dec 19, 2014 1:31 am

Help with copying folders


All times are UTC - 6 hours


Post new topic Reply to topic  [ 5 posts ] 
Author Message
 PostPosted: Sun Aug 02, 2009 1:22 am   

Joined: Sun Aug 02, 2009 1:17 am
Posts: 5
I want to copy folders from one folder to another.
In the "cp" man page, I read this
Quote:
......... -r option is strongly discouraged, as it
does not correctly copy special files, symbolic links, or fifo's.

The -v and -n options are non-standard and their use in scripts is not recommended.


I could not find a way to get a warning before over-writing folders like in the case of copying files where "-i" can be used and then "y" or "n" can be specified.
This is because according to the man page "
Quote:
In -R mode, cp will continue copying even if errors are detected.
" which means that "-R" over-writes the "-i" option.
Please help.


Top
 Profile WWW  
 PostPosted: Mon Aug 03, 2009 12:20 am   
User avatar

Joined: Sat Jun 13, 2009 8:53 pm
Posts: 73
Location: Texas!
'cp -iR' will still prompt you before every overwrite. Additionally, you might be interested in '-u', as it only overwrites files if the timestamp on the replacing file is newer.


Top
 Profile  
 PostPosted: Tue Aug 04, 2009 10:31 am   

Joined: Sun Aug 02, 2009 1:17 am
Posts: 5
Thanks for the prompt reply.
The man page says:
Quote:
In -R mode, cp will continue copying even if errors are detected.

What kind of errors ? If i am copying three files and two get copied and one does not get copied due to error, will such error be suppressed? I don't know how I can test this. So i hope you know the answer.
I have no reasons to suppress any kind of errors. I would actually want to see the errors.


Top
 Profile WWW  
 PostPosted: Tue Aug 04, 2009 11:24 pm   

Joined: Mon Nov 17, 2008 7:25 am
Posts: 221
I'm just guessing here, but i think they mean that even if a file cannot be copied (like permission denied error) it will continue to copy the rest of the files unlike regular copy which will stop if 1 error is encountered?

Best regards
Fredrik Eriksson


Top
 Profile  
 PostPosted: Wed Aug 05, 2009 2:35 am   

Joined: Sun Aug 02, 2009 1:17 am
Posts: 5
Thanks, I will use the command. Let's see what happens!


Top
 Profile WWW  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP