From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: David Masterson Newsgroups: gmane.emacs.help Subject: Re: Changing file names with "--" to "-" recursively Date: Sun, 21 Feb 2021 22:36:19 -0800 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27397"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) Cc: Help Gnu Emacs To: wael-zwaiter@gmx.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 22 07:52:12 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lE54m-000723-0E for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 22 Feb 2021 07:52:12 +0100 Original-Received: from localhost ([::1]:43944 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lE54l-0001oP-16 for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 22 Feb 2021 01:52:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55084) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE545-0001ld-8w for help-gnu-emacs@gnu.org; Mon, 22 Feb 2021 01:51:29 -0500 Original-Received: from mail-mw2nam08olkn2097.outbound.protection.outlook.com ([40.92.46.97]:46688 helo=NAM04-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lE543-0004H7-AS for help-gnu-emacs@gnu.org; Mon, 22 Feb 2021 01:51:29 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UU5PXLgd5nRpS+qnWiLffz53C0nGwD7kfRDroSiVg8OuSeUfKxEiB7d/ORvP2j3VlvzIIR7wHwGI509At9gHUlUSOosrP/grjVCjnojYL/Ul55AYVxp4/Mk7Ioyvpm4sFbeLgxjuag93LwXwX6LgCdqjnNF6DSHElzFbz8mx0nVIESWtDs+QLh+3bSqrp/iSg1mX9XEGmy9P3wsnie+9XFSLGDE3OYkbySDQW8dCMuM3a8ZT9T4C9L/QdXdeutQIrTKx90rqHoqGV2NLqM/jLfDVnkK6zYJsMbxYda644zV5Zyv/gjvljAT8QennVp+0QKReZgj0cc2pK4xzGQfVLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3gjugsfy2iFIeR5BwD0jUUZcbCNzyDRj86/W0eax3HY=; b=F64Z9pAhj5EjD1T5S+k2D20Gr9R+IKEeV35Vs+RYG54dzf2eje0voTncXxj06MgxofhHVIisAyLc7eYgIFSZvlS3NmDmdXtfumeIt8F5gfkpAlvtNzQew941HQzZmsORgbTOwZohBPpQQM9g98RyD/ze7Cch0UwxByopQiwQ7bkXA+jyJgwg9efluNUb/JUnR6pA9jJegfpqmhRrS90uAam0SzngFXP+ZOV0ZW3VzU/ioh9lECQjpTorHAe6AX3CdfZyZ0TLt2vksigbuOjsrbUIczXcY3VPvosZTbCf0gekzj49jIQk9tHC7l+tpFtcpEPvosQud9B+zUYv/OX2Vg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3gjugsfy2iFIeR5BwD0jUUZcbCNzyDRj86/W0eax3HY=; b=E+ZSxXyIWJbjEYv3OvUP8wQJCrGrsbq3XNGBedo5zd5tTMJo4vK2p7FzBJ+cWh5i1nOyt63ilC/1maopDWVDxU1L8sVaPOC+WCmVk+yUGWhLMRnjbjiDL6i/RLIqul+XSjulUnjO09EUBeLu01BT1hLbIYTgaUWpcnjeOfZo5UqOzYtocK4PJvxpnUnrHslmHqgqDhD5TnUYM1YN9245NX6yEeyAhFWNrVAAC4d3Moxmxc1KUcvdldSYmYK+OCJpIl4qDGm5mHlOsfGnQ/AqBYDOppi6sTkxS/zoAhD4G94dIkUWmX4/IXaBzr5W+rV5HU6gK1zhAvFTPkJU+TXgsg== Original-Received: from SN1NAM04FT057.eop-NAM04.prod.protection.outlook.com (10.152.88.55) by SN1NAM04HT049.eop-NAM04.prod.protection.outlook.com (10.152.89.60) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Mon, 22 Feb 2021 06:36:22 +0000 Original-Received: from SJ0PR03MB5455.namprd03.prod.outlook.com (2a01:111:e400:7e4c::45) by SN1NAM04FT057.mail.protection.outlook.com (2a01:111:e400:7e4c::302) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 06:36:22 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:E1E3369F498D0B32ABCBE2A568084BC6AA69A5F5B67942B4D366F35A8644BB39; UpperCasedChecksum:9F5CCB828F9B6CCBFBD19820DC66370FAAE72E7EADA6FBA33916685A020DE5FD; SizeAsReceived:7613; Count:46 Original-Received: from SJ0PR03MB5455.namprd03.prod.outlook.com ([fe80::952c:21a3:a963:8107]) by SJ0PR03MB5455.namprd03.prod.outlook.com ([fe80::952c:21a3:a963:8107%6]) with mapi id 15.20.3846.041; Mon, 22 Feb 2021 06:36:22 +0000 In-Reply-To: (Jean Louis's message of "Sun, 21 Feb 2021 09:45:00 +0300") X-TMN: [ZqmHTKMVvFb95Mw9suCgP8WN/SppCi5N+/uynja6tDucAkRv9aMIUHVwPwul+7wE] X-ClientProxiedBy: BYAPR01CA0022.prod.exchangelabs.com (2603:10b6:a02:80::35) To SJ0PR03MB5455.namprd03.prod.outlook.com (2603:10b6:a03:27b::11) X-Microsoft-Original-Message-ID: <87tuq4ip7g.fsf@outlook.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from penguin (2600:8802:501:6200:216:3eff:fee7:3d5d) by BYAPR01CA0022.prod.exchangelabs.com (2603:10b6:a02:80::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Mon, 22 Feb 2021 06:36:21 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 46 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 51910ad1-b0d6-416a-b937-08d8d6fc2b53 X-MS-TrafficTypeDiagnostic: SN1NAM04HT049: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QSNRHH+1A06QwOln0jvb4yFqDN9jtzVAp/0pRcJyET2Sql8MEF4EAMJkOlJls0ScxOJ3ScNiFNBEjqbZ+wVzwA48WY2TVsBJd1EW7hpSaUFRPSEnt+r6nxKwqUKaWZ9kLTV6xQfyKiN7R0bDq6OMURNnUwCNlMXsi67qqzYL6Yg1XqFxew2ojUT3AovVXWXTlzNq27OxpILq8/aSPc1fHaaJNHNzpbdWCAsSMuycOKhzap0wdB3HcJQGlnnhQFhPoPvop7qMiGiWHnivWjfPukdnuC4KILsOg2z0ryfti3FQ2j/TcvhT+PG5J1uABSkO8yzfdyQ6I0sfPS2B/9MSxJXrY6SON8qkHOhNZ57gG2MPgmZqDRvnnCFGAYhMls9v X-MS-Exchange-AntiSpam-MessageData: GFhDDeJRErQzi8nkDT3ns11gmhjMJ5uDZjHlcag42X4tPaCXPNkPdbUb7RCL9UqVwFRiCY1srX+anDUGRX9JwBPRioAgiOSIxfXudHn6i7o5dkgd2DTcT0V4xud684cXi+HE2GNRekZx1KBMwYr7NX0tc9dIWy1i4PLGc22shzWoKou4SSCxMO/kyusJL6Yz0aeqhimAH1FJoZf1foSdWA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 51910ad1-b0d6-416a-b937-08d8d6fc2b53 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2021 06:36:22.3111 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: SN1NAM04FT057.eop-NAM04.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1NAM04HT049 Received-SPF: pass client-ip=40.92.46.97; envelope-from=dsmasterson92630@outlook.com; helo=NAM04-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -7 X-Spam_score: -0.8 X-Spam_bar: / X-Spam_report: (-0.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, FREEMAIL_REPLY=1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:128193 Archived-At: Jean Louis writes: > * wael-zwaiter@gmx.com [2021-02-21 06:07]: >> >> I have a lot of files and want to change "--" to "-". >> >> Am using >> >> rename 's/--/-/g' * >> >> on the current directory. >> >> How can I recursively go through all sub directories and do the >> changes for files only. > > The command: > > $ rename 's/--/-/g' * > > does not work on my side as it works on yours, maybe it is different > software. > > You do as following in the top directory: > > for i in $(find . -type f -iname "*--*"); do mv $i $(echo $i | sed -e "s/--/-/"); done > That should be "s/--/-/g" to handle files like "aaa--bbb--ccc" > > You may alias the command to: > > alias renamedashes='for i in $(find . -type f -name "*--*"); do mv $i $(echo $i | sed -e "s/--/-/"); done' > > and invoke it with > > $ renamedashes > > in future. > -- David Masterson