From nobody Sat Feb 11 18:46:46 2023 X-Original-To: questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PDfhy15F1z3psNP for ; Sat, 11 Feb 2023 18:46:58 +0000 (UTC) (envelope-from boyvalue@gmail.com) Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PDfhx0xLMz4cnT for ; Sat, 11 Feb 2023 18:46:57 +0000 (UTC) (envelope-from boyvalue@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=EhyZNRik; spf=pass (mx1.freebsd.org: domain of boyvalue@gmail.com designates 2607:f8b0:4864:20::82b as permitted sender) smtp.mailfrom=boyvalue@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-qt1-x82b.google.com with SMTP id ch10so8448401qtb.11 for ; Sat, 11 Feb 2023 10:46:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=FfupPVnazNN95uXt1tDUj8M/1j31iNEzMFglNsu7t58=; b=EhyZNRikzQNKliPAvYhekgLfp+xETRVbpSpsjDiFeNzCVqfv7IMJbZGvyXqjsOBIsC L3ZBqXS8kHFU0r/iYRj5ZvGG07cXM0x6g613MV7zxwTU/7bow1vqoVY2ZyzPvKj87pxr FbUF+GxqSfAomGk+pk8zMWsjMUBL6jsMclQ7IPXjhnUPaGRqZ1qOQC5QXJ5hN9FV3Ma0 ee3hylQzbNOXCCoUYi6PBXIO0+KWRvWUkHN66HJy5+XW/vY1xzDHfcyv0LXXr5v5jpZg LS6itaC9w13zJ9M+GEJaXAvvls5lOD2gdiio+k7riQ+ypK9RKbI39quNwKbMkb/2If2i hN+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FfupPVnazNN95uXt1tDUj8M/1j31iNEzMFglNsu7t58=; b=he8/6v66vLVZC6biZNyvl3rPJLxzt8U+UPoCgcHasY7C6hY8m/brbMF0lB5L/46aJC vFjEbaG8l0GXle9CblAfy7v0cJSmPCheRkfAjD8AR/fpVEPM/WA52LYcblIg0mschY6G kqzO5yzPrBifc001H8IOqbcY5LKlwvbCrIvVp7TljiVPPf8dKDSzZgwtMXJqpVGKLm3I hG5hvhQlir+CGYnRl2qNsSaB6Lfnf7r6CIZVTQu1R1cuIJTafTBxlvxnFVKxI3CN7Yb2 /3x6PqyBzmcMEscuLXzXPYcshmLIYIKn6uXc5vWiNszg3WSN70CFOSuFKBKoAEpkflfl qj3g== X-Gm-Message-State: AO0yUKVyf+42SVjIZPdYlEqclNi9pJR5m+QfkmcroNLvnyk4Czt7zCjm Qy9Hn2al+qMvRwtHHb7pUbsNobz25hRetFRpNbSFnMOlxg== X-Google-Smtp-Source: AK7set92kOIF4blQNRa2LwMBtmZMm7IW4HM6VO1eGvBbu1ZJjKlkv/yxnB8MRIXwK08wF5Xm5wWBMPreyXvR/Ickb6k= X-Received: by 2002:a05:622a:593:b0:3b9:b59e:12bb with SMTP id c19-20020a05622a059300b003b9b59e12bbmr3177422qtb.208.1676141216190; Sat, 11 Feb 2023 10:46:56 -0800 (PST) List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org MIME-Version: 1.0 References: In-Reply-To: From: Scott Ballantyne Date: Sat, 11 Feb 2023 13:46:46 -0500 Message-ID: Subject: Re: remove double quote character from file names To: Per olof Ljungmark Cc: questions@freebsd.org Content-Type: multipart/alternative; boundary="000000000000c8d7ff05f47109c8" X-Spamd-Result: default: False [-2.43 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-0.996]; NEURAL_SPAM_SHORT(0.56)[0.561]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; MLMMJ_DEST(0.00)[questions@freebsd.org]; FROM_EQ_ENVFROM(0.00)[]; ARC_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_COUNT_TWO(0.00)[2]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::82b:from]; MID_RHS_MATCH_FROMTLD(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; TO_DN_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[questions@freebsd.org]; RCVD_TLS_LAST(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-Rspamd-Queue-Id: 4PDfhx0xLMz4cnT X-Spamd-Bar: -- X-ThisMailContainsUnwantedMimeParts: N --000000000000c8d7ff05f47109c8 Content-Type: text/plain; charset="UTF-8" Script started on Sat Feb 11 13:17:38 2023 $ touch \"f\"o\"o $ touch \"bar\" $ touch \"f\ o\ o\" $ ls "bar" "f o o" "f"o"o typescript $ for f in $(find . -type f -name '*"*'); do mv $f $(echo $f | tr -d '"'); done mv: rename ./"f to ./f: No such file or directory mv: rename o to o: No such file or directory mv: rename o" to o: No such file or directory $ S="$IFS" $ IFS="\n" $ for f in $(find . -type f -name '*"*'); do mv $f $(echo $f | tr -d '"'); done $ ls bar f o o foo typescript $ IFS="$S" $ exit Script done on Sat Feb 11 13:21:41 2023 On Sat, Feb 11, 2023 at 1:00 PM Scott Ballantyne wrote: > > > On Sat, Feb 11, 2023 at 11:43 AM Per olof Ljungmark > wrote: > >> On 2/11/23 16:43, Scott Ballantyne wrote: >> > >> > Remove the first echo command to actually do any changes. Untested. >> > for f in $(find . -type f -name '*"*'); do echo mv $f $(echo $f | tr -d >> > '"'); done >> >> Produced "No such file or directory" errors. > > > You must have spaces in the filenames. You can deal with that using IFS. > > >> > >> >> --000000000000c8d7ff05f47109c8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Script started on Sat Feb 11 13:17:38 2023
$ touch \&q= uot;f\"o\"o
$ touch \"bar\"
$ touch \"f\ o\ = o\"
$ ls
"bar" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &quo= t;f o o" =C2=A0 =C2=A0 =C2=A0 =C2=A0 "f"o"o =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0typescript
$ for f in $(find . -type f -n= ame '*"*'); do =C2=A0mv $f $(echo $f | tr -d '"')= ; done
mv: rename ./"f to ./f: No such file or directory
mv: ren= ame o to o: No such file or directory
mv: rename o" to o: No such f= ile or directory
$ S=3D"$IFS"
$ IFS=3D"\n"
$ f= or f in $(find . -type f -name '*"*'); do mv $f $(echo $f | tr= -d '"'); done
$ ls
bar =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 f o o =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 foo =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 typescript
$ IFS=3D"$S"
$ e= xit
Script done on Sat Feb 11 13:21:41 2023

--000000000000c8d7ff05f47109c8--