Re: remove double quote character from file names
- In reply to: Matthew Seaman : "Re: remove double quote character from file names"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 11 Feb 2023 17:32:05 UTC
On Sat, Feb 11, 2023 at 9:29 AM Matthew Seaman <matthew@freebsd.org> wrote: > > The tools from the base system that you need here are find(1), sed(1), > mv(1) and sh(1). Something like the following _completely_ _untested_ > code: > > ``` > #!/bin/sh > > for oldfname in $( find . -type f -name '*"*' -print ); do > newfname=$( echo $oldfname | sed -e 's/"/in/g' ) > echo mv -nv $oldfname $newfname > done > ``` > > This prints out a list of 'mv' commands to effect the change you want. > Which, as someone else wisely said you should examine closely to ensure > it is actually doing the right thing. Then, when you're satisfied that > it is, change 4 to read: > > mv -nv $oldfname $newfname > > obvious, I expect, but when I have done this, I > it all to a file and then review it, add the mv or whatever command to each line, and then feed that to the shell.