When copying multiple files from one directory to another is there a way to get bash to run through each file and ask for y/n? I vaguely remember adding something to the end of my command like 'ok?' to make it do this, but I can't find it anywhere!


I suspect that you’re remembering the -ok option to find.  Try something like

find . -name pattern -ok cp {} other_directory \;
  • Thank you so much! It's been driving me insane for the last hour! – gray_fox Mar 20 '14 at 23:15

Use -i switch (interactive). It works for cp/mv/rm/...

  • 1
    But doesn't i switch work only when there is overwrite cases? I mean for normal copies, there will be no prompt to the user. – Ramesh Mar 20 '14 at 22:28
  • 1
    Yeah, I want it to prompt even for normal copies. I know it exists, I used it months ago when setting up my raspberry pi but I've forgotten it now! – gray_fox Mar 20 '14 at 22:37
  • In that case, just replace cp with echo to see what will get copied. – orion Mar 21 '14 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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