Date: Sat, 11 Feb 2023 09:40:11 -0600 From: Tim Daneliuk <tundra@tundraware.com> To: FreeBSD Mailing List <freebsd-questions@freebsd.org> Subject: Re: remove double quote character from file names Message-ID: <d67caf48-09d6-4864-0b1c-7d64a1a14a76@tundraware.com> In-Reply-To: <CADqw_gK_3htmJZicOLLODS-MZJUTwV%2BfttBzVEqsP3KztDk10A@mail.gmail.com> References: <d83c93ad-0eac-d41a-c7db-79a1e1bc62d8@nethead.se> <CADqw_gK_3htmJZicOLLODS-MZJUTwV%2BfttBzVEqsP3KztDk10A@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> On Sat, Feb 11, 2023, 15:59 Per olof Ljungmark <peo@nethead.se <mailto:peo@nethead.se>> wrote: > > Hi all, > > 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. > > I am sure plenty of you have done this before... I've gotten as far as > > find . -type f -name '*"*' -exec rename 's|"|in|g' {} \; > find: rename: No such file or directory > > The find part works but not renaming so I'm missing something there. > <Shameless self-promotion follows ;) > Some years ago I set about to write the mother of all renaming utilities exactly because I didn't want to have to go through endless contortions of sed, gerp, awk, ag, and so forth to do simple renaming tasks like yours. The result is 'tren' which does what you want rather trivially: find ./ -name '*"*' -exec tren -r'"'=X {} \; tren can do way more than this (and probably has plenty of undiscovered edge cases and/or bugs), but I use it regularly and it has vastly simplified my renaming tasks. Code and extensive docs here: https://gitbucket.tundraware.com/tundra/tren HTH...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d67caf48-09d6-4864-0b1c-7d64a1a14a76>