I have quite a number of files and directories with spaces in their filenames in my ext4 filesystems.
How should I safely find and rename them? I have bash and am running Ubuntu.
Is it possible to interactively rename each found file, i.e. be asked if I want to rename what to what for each file?
What convention for choosing filenames would you use to rename them?
find
andxargs
more complicated. – Tim Feb 28 '16 at 00:04find -name '* *' -execdir sh -c 'mv -i "$1" "$(<<<$1 sed "s/ /_/g")"' _ {} \;
, but the-i
argument tomv
isn't working in the script, so it's not interactive. I guess you could just use a more complicatedread
conditional. – Sparhawk Feb 28 '16 at 00:09-i
is only interactive if it's overwriting. Is that what you want, or do you want to be interactive in all cases? – Sparhawk Feb 28 '16 at 00:17