When I issue the command cp -af --reply=yes * ../other it tells me --reply is deprecated and use -i or -f.
when I remove the --reply=yes I have to indicate 'y' to every file being copied.
I just want to copy every file in my current directory to another directory and overwrite any file that is there.
What is the correct way to do that?
Jerry
Jerry Geis wrote:
When I issue the command cp -af --reply=yes * ../other it tells me --reply is deprecated and use -i or -f.
when I remove the --reply=yes I have to indicate 'y' to every file being copied.
I just want to copy every file in my current directory to another directory and overwrite any file that is there.
What is the correct way to do that?
Use -f as the you got as the error message.
[angenenr@shutdown test]$mkdir a b [angenenr@shutdown test]$touch a/foo a/bla [angenenr@shutdown test]$touch b/foo b/bla [angenenr@shutdown test]$cp -f a/foo a/bla b/ [angenenr@shutdown test]$
Cheers,
Ralph
On Mon, Jan 28, 2008 at 01:45:15PM -0500, Jerry Geis alleged:
When I issue the command cp -af --reply=yes * ../other it tells me --reply is deprecated and use -i or -f.
when I remove the --reply=yes I have to indicate 'y' to every file being copied.
I just want to copy every file in my current directory to another directory and overwrite any file that is there.
What is the correct way to do that?
Using csh/tcsh?
You are running into an alias. Simply escape cp or call with full path: \cp -f /bin/cp -f
Jerry Geis wrote:
When I issue the command cp -af --reply=yes * ../other it tells me --reply is deprecated and use -i or -f.
when I remove the --reply=yes I have to indicate 'y' to every file being copied.
I just want to copy every file in my current directory to another directory and overwrite any file that is there.
What is the correct way to do that?
I assume you're doing this as root... The system-defined shell aliases are your enemy. Try typing /bin/cp instead of just cp to bypass the nanny-OS insisting that you need interactive mode instead of defaulting to doing what you said. (Type "which cp" to see what is happening).
-- Les Mikesell lesmikesell@gmail.com
On Mon, Jan 28, 2008, Jerry Geis wrote:
When I issue the command cp -af --reply=yes * ../other it tells me --reply is deprecated and use -i or -f.
when I remove the --reply=yes I have to indicate 'y' to every file being copied.
I just want to copy every file in my current directory to another directory and overwrite any file that is there.
What is the correct way to do that?
``unalias cp'' then do your real work.
You will then only be prompted when attempting to remove files without write permission.
If you feel like a responsible adult, you might want to comment out the other aliases in your .profile or other startup files which appear as:
alias rm='rm -i' alias cp='cp -i' alias mv='mv -i'
Bill -- INTERNET: bill@celestial.com Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676
Mechanical Engineers build weapons. Civil Engineers build targets.
Jerry Geis wrote:
When I issue the command cp -af --reply=yes * ../other it tells me --reply is deprecated and use -i or -f.
when I remove the --reply=yes I have to indicate 'y' to every file being copied.
I just want to copy every file in my current directory to another directory and overwrite any file that is there.
What is the correct way to do that?
As others have mentioned, I usually just do 'unalias cp' first. But you can also do yes | cp (cp options) which will say y to every prompt cp spits out.
nate
On Mon, 28 Jan 2008 11:12:41 -0800 (PST) "nate" centos@linuxpowered.net took out a #2 pencil and scribbled:
Curious question that is directly related to this. This did work on my system; however, I'm not sure if this is something one wants to be doing. If one were to type literally:
"cp" -fr somedir somefile ~/
Would this defeat the alias (in bash)?
On Mon, 2008-01-28 at 13:22 -0600, Alex White wrote:
Curious question that is directly related to this. This did work on my system; however, I'm not sure if this is something one wants to be doing. If one were to type literally:
"cp" -fr somedir somefile ~/
Would this defeat the alias (in bash)?
[ignacio@localhost ~]$ alias foo=bar [ignacio@localhost ~]$ foo bash: bar: command not found [ignacio@localhost ~]$ "foo" bash: foo: command not found [ignacio@localhost ~]$ \foo bash: foo: command not found
On Mon, 28 Jan 2008 14:25:27 -0500 Ignacio Vazquez-Abrams ivazqueznet@gmail.com took out a #2 pencil and scribbled:
[ignacio@localhost ~]$ alias foo=bar [ignacio@localhost ~]$ foo bash: bar: command not found [ignacio@localhost ~]$ "foo" bash: foo: command not found [ignacio@localhost ~]$ \foo bash: foo: command not found
Interesting. Here's an example of what I see on my system with cp aliased to cp -i
[prata@crane ~]$ which cp alias cp='cp -i' /bin/cp [prata@crane ~]$ touch test.tst [prata@crane ~]$ "cp" -rf test.tst test.keytest
Thanks for that information, I need to read the howto on bash scripting again! *blinks*
Thanks!
Alex White wrote:
On Mon, 28 Jan 2008 14:25:27 -0500 Ignacio Vazquez-Abrams ivazqueznet@gmail.com took out a #2 pencil and scribbled:
[ignacio@localhost ~]$ alias foo=bar [ignacio@localhost ~]$ foo bash: bar: command not found [ignacio@localhost ~]$ "foo" bash: foo: command not found [ignacio@localhost ~]$ \foo bash: foo: command not found
Interesting. Here's an example of what I see on my system with cp aliased to cp -i
[prata@crane ~]$ which cp alias cp='cp -i' /bin/cp [prata@crane ~]$ touch test.tst [prata@crane ~]$ "cp" -rf test.tst test.keytest
Thanks for that information, I need to read the howto on bash scripting again! *blinks*
The shell does not apply aliases to commands executed from scripts.
On Mon, 28 Jan 2008 15:57:44 -0600 Robert Nichols rnicholsNOSPAM@comcast.net took out a #2 pencil and scribbled:
The shell does not apply aliases to commands executed from scripts.
I knew that...after testing it an hour ago. In the corner of my mind somewhere I knew that as I have scripted in a limited fashion in the past.
Thanks for that tidbit of reminder though.
Alex White wrote:
On Mon, 28 Jan 2008 11:12:41 -0800 (PST) "nate" centos@linuxpowered.net took out a #2 pencil and scribbled:
Curious question that is directly related to this. This did work on my system; however, I'm not sure if this is something one wants to be doing. If one were to type literally:
"cp" -fr somedir somefile ~/
Would this defeat the alias (in bash)?
Any quoting style: \cp "cp" 'cp' should keep the alias from expanding, as does specifying the full path: /bin/cp. But with quoting you sometimes have to be aware of how many times the line will be parsed.