LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-02-2007, 01:39 PM   #1
punt
Member
 
Registered: Jun 2001
Distribution: Fedora 22
Posts: 371

Rep: Reputation: 30
Non-deprecated version of cp --reply=no


This is a strange and hopefully not too newbie question (I've asked my linux gurus and they actually cannot find an answer for me!)

I used to have a really effective cron job that copied data from one drive to another using the following code:

Code:
cp -r --reply=no dir1/* dir2/
Now, I'm being told that --reply=no is deprecated. I can't figure out what I can use to replace this.

Basically, here's my pseudocode of what I'm looking for:

"copy recursively each subdirectory in dir1/* to dir2, and if the file exists in dir2, don't overwrite."

cp -f doesn't do it, and for whatever reason, it's always interactive. I am trying to avoid having to hit n n n n n n n n and having the same results as I once achieved with the deprecated --reply=no.

What's the new format that would work for me here?

Thanks.
 
Old 07-02-2007, 04:53 PM   #2
rednuht
Member
 
Registered: Aug 2005
Posts: 239
Blog Entries: 1

Rep: Reputation: 31
its a hack but if you want n n n n n n n
then
Code:
yes n
will do it for you
Code:
cp -r dir1 dir2 < yes n
also check for aliases just run
Code:
alias
it might not be running cp directly.

I was sure there was an environment var to set but I can not find it.
 
Old 07-02-2007, 06:15 PM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
You could use

yes n | cp -ri dir1/* dir2/ --

or

cp -ri dir1/* dir2/ -- < <(yes n)

or

cp -ri dir1/* dir2/ < <(! :) 2>/dev/null

Last edited by jschiwal; 07-02-2007 at 07:53 PM.
 
Old 07-02-2007, 09:11 PM   #4
punt
Member
 
Registered: Jun 2001
Distribution: Fedora 22
Posts: 371

Original Poster
Rep: Reputation: 30
That gets so complicated. I wish they didn't deprecate a rather useful command. Thanks for the tips.
 
Old 07-03-2007, 06:04 AM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Quote:
Originally Posted by punt
That gets so complicated. I wish they didn't deprecate a rather useful command. Thanks for the tips.
I agree, I don't understand why they would drop it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
rc.modules deprecated? hussar Slackware 2 09-23-2006 01:46 PM
Debfoster deprecated :( Aptitude doesn't like me RodWC Debian 4 06-12-2006 05:24 PM
network/options is deprecated Acron_0248 Debian 3 03-19-2006 06:12 PM
post reply & submit reply buttons annehoog LQ Suggestions & Feedback 10 01-05-2004 06:43 PM
Evolution - reply - missing own reply emanuelgreisen Linux - Software 0 01-31-2003 04:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration