Re: remove double quote character from file names
- In reply to: Kurt Hackenberg : "Re: remove double quote character from file names"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 11 Feb 2023 18:40:27 UTC
On Sat, Feb 11, 2023 at 1:32 PM Kurt Hackenberg <kh@panix.com> wrote:
> On Sat, Feb 11, 2023 at 03:58:50PM +0100, Per olof Ljungmark wrote:
>
> >A little help on the way, I need to find and remove the double quote (")
> >character from all files in a directory structure containing hundreds of
> >thousands of files.
>
> That's nasty. Be careful, keep backups.
>
> I might use a full-on programming language -- maybe Python or Ruby --
> to avoid the difficulties of shell parsing and quoting. However, if you
> want to do it through a shell, this might be helpful:
>
> <https://dwheeler.com/essays/filenames-in-shell.html>
>
>
My way. Doesn't account for spaces in filenames, but that's easily added
with -print0 flags to find and -0 flags to xargs:
ls *\"* | perl -lne '$n=$_;$n=~tr/"//d;rename($_,$n);'
~Paul
--
__________________
:(){ :|:& };: