Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a batch file that, among other things, uses the command mmv to rename some files. The relevant line is like this:

mmv "$BASEDIR/files/*.txt" "$BASEDIR/files/#1.strings"

In essence it works, but the problem is that it keeps asking me for confirmation to overwrite files when they happen to already exist. I want it to just go ahead and do that without confirmation, so I checked the man page for mmv, and it says to simply use the -o option, like this:

mmv -o "$BASEDIR/files/*.txt" "$BASEDIR/files/#1.strings"

It's not making any difference, though. Every time I run my script, when it comes to the mmv part, it starts asking me confirmation.

Why is the -o option not doing its job, and how do I get mmv to overwrite without asking confirmation?

share|improve this question

1 Answer 1

Try adding -d to your command line:

Collisions and Deletions

When any two or more matching files would have to be moved, copied, or linked to the same target filename, mmv detects the condition as an error before performing any actions. Furthermore, mmv checks if any of its actions will result in the destruction of existing files.

If the -d (delete) option is specified, all file deletions or overwrites are done silently.

share|improve this answer
    
Thanks for this. Adding the -d option now prevents confirmation. However, one additional issue. It's not moving the files to the new names, it's copying them. So, in the directory I'm acting on, I end up with two sets of the files, one with the old names and one with the new. The man page seems to indicate mmv -xo -d or mmv -mo -d should move and delete the original copies, but I just get it outputting a usage error. How do I get it to remove the files with the old name? –  Questioner Feb 16 '13 at 4:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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