I have try to see the man of cp but there are not options that to set it not overwirte any file. finally I choose to use interactive mode but it is slow. Any suggestion?
You might try the following.
1. Create a small script like the one below, save it as "no.sh" and set execute permission on it:
Code:
while true
do
echo no
done
2. Use a command similar to this one: no.sh | cp -i srcfiles destdir
I cannot test this on Solaris right now, but it works on HP-UX (on HP-UX, the script is not necessary because the command "yes" can be used to do the same thing - unfortunately, I don't know if a similar command exists on Solaris).
This is somewhat dirty because you will force the answer "no" to every question. You might get unexpected results if a question different than "Overwrite (y/n)?" arises.
A better solution would be to create a script for the copy and have it verify if the destination file exists before copying.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.