15

So I've aliased the commands rm/cp/mv to use interactive (-i) mode by default to avoid accidentally deleting things, but sometimes this is pretty inconvenient.

I would like to be able to say 'y' to all the prompts of the form:

mv: overwrite `file_1'? y 
mv: overwrite `file_2'? y 

without typing 'y' many many times. Is there a way to do this?

1
  • I do not understand what you exatly want. Please edit your answer to describe it more (what you tried to do and what you really expected) Commented Oct 18, 2015 at 21:43

2 Answers 2

9

Use command mv to circumvent the alias and use --force if that doesn't stop mv from bothering you with questions (e.g., because of permissions).

yes | aCommand is the standard way to supply lots of y's to aCommand, but in this case that seems unnecessary.

3
  • 1
    So I can't do this "interactively", i.e. use mv -i and then once it starts prompting me, tell is "yes to all"? Commented Oct 18, 2015 at 21:58
  • 1
    This kind of thing is generally quite hard to do unless the program directly supports it (and I believe mv doesn't support this). Cancelling the action (Ctrl-C) and starting from scratch tends to be easier. Commented Oct 18, 2015 at 22:00
  • agree that you can't switch horses in the middle of the stream. Another solution like command mv, is to use the full path you the cmd. i.e. /bin/mv files ... when you want to skip the -i part. Good luck.
    – shellter
    Commented Oct 19, 2015 at 8:51
5

you can use back slash before cp

\cp -rf /from/directory/* to/directory

Not the answer you're looking for? Browse other questions tagged or ask your own question.