This one is about as simple as it gets.
Recently I was cleaning up an old hard drive. I wanted to copy everything off of it before I re-formatted it.
so I used the trusty old...
Because the "f" is supposed overwrite existing files, right?
Well, instead, it was asking thousands of times, "Do you want to over write existing file Y/n?".
Well after about a dozen of those, that gets old, I saw that I still had 11,735 files to go. Not good. I was going to have one tired finger
from pressing "Y" eleven thousand more times. So what do we do?
Just say yes.
This will pipe the "yes" answer to any commands I'm doing.
I noticed I didn't have a "no" command. But I'm not sure what I would have used it for.
Recently I was cleaning up an old hard drive. I wanted to copy everything off of it before I re-formatted it.
so I used the trusty old...
Code:
cp -rvf /mnt/* /destination/directory
Well, instead, it was asking thousands of times, "Do you want to over write existing file Y/n?".
Well after about a dozen of those, that gets old, I saw that I still had 11,735 files to go. Not good. I was going to have one tired finger
from pressing "Y" eleven thousand more times. So what do we do?
Just say yes.
Code:
yes | cp -rvf /mnt/* /destination/directory
This will pipe the "yes" answer to any commands I'm doing.
I noticed I didn't have a "no" command. But I'm not sure what I would have used it for.
Last edited: