How to rename a bunch of files to eliminate quote marks
linux
Solution
simple single line bash code:
for f in *; do mv -i "$f" "${f//[\"[:space:]]}"; done
`$f` is your current file name and `${f//[\"[:space:]]}` is your bash substring replacer which stands for: in this `f` (file name), `//` (replace) these `[\"[:space:]]` (characters) with nothing[1].
NOTE 1: string replacement statement: `${string//substring/replacement}`; because you don't need to replace your substring to nothing, leave `/replacement` to blank.
NOTE 2: `[\"[:space:]]` is `expr` regular expression.
Problem
My iomega NAS, which uses a linux-like OS, has a bunch of backed-up files on it with filenames containing double quotes. Like this: "Water"-4 "Water"-5 etc. (don't ask how they got there; they were originally created on a Mac) This is causing problems when I try to copy the files to a backup drive: the quote marks are apparently causing the copy to fail. (The built-in copy facility uses rsync, but a rather old version.) Is there a terminal command to batch-rename these files, just deleting the quote marks? Failing that, is there a command to rename them one at a time? The quote marks seem to really be messing things up (I know: the user has been warned!)