From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: jadamson@partners.org (Joel J. Adamson) Newsgroups: gmane.emacs.help Subject: Re: Easy way to rename files sequentially? Date: Tue, 27 Nov 2007 17:00:38 -0500 Message-ID: <877ik3s60p.fsf@W0053328.mgh.harvard.edu> References: <87ejeexgfy.fsf@celephais.home.net> <871waeroap.fsf@newsguy.com> <8763zpwje7.fsf@newsguy.com> <87bq9fsb1f.fsf@W0053328.mgh.harvard.edu> <871wabv0bf.fsf@thievol.homelinux.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1196200961 24498 80.91.229.12 (27 Nov 2007 22:02:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 27 Nov 2007 22:02:41 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Thierry Volpiatto Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Nov 27 23:02:48 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Ix8UY-0005s7-0P for geh-help-gnu-emacs@m.gmane.org; Tue, 27 Nov 2007 23:01:18 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ix8UI-0004iv-UX for geh-help-gnu-emacs@m.gmane.org; Tue, 27 Nov 2007 17:01:02 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ix8Tz-0004hD-Np for help-gnu-emacs@gnu.org; Tue, 27 Nov 2007 17:00:43 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ix8Tz-0004gs-1i for help-gnu-emacs@gnu.org; Tue, 27 Nov 2007 17:00:43 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ix8Ty-0004gn-Nd for help-gnu-emacs@gnu.org; Tue, 27 Nov 2007 17:00:42 -0500 Original-Received: from phsmgmx10.partners.org ([155.52.251.101]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.60) (envelope-from ) id 1Ix8Ty-0007d1-6w for help-gnu-emacs@gnu.org; Tue, 27 Nov 2007 17:00:42 -0500 X-IronPort-AV: E=Sophos;i="4.23,220,1194238800"; d="scan'208";a="69319341" Original-Received: from phsxcon1.mgh.harvard.edu (HELO PHSXCON1.partners.org) ([132.183.130.40]) by phsmgmx10.partners.org with ESMTP; 27 Nov 2007 17:00:39 -0500 Original-Received: from PHSXMB8.partners.org ([170.223.201.59]) by PHSXCON1.partners.org with Microsoft SMTPSVC(6.0.3790.3959); Tue, 27 Nov 2007 17:00:40 -0500 Original-Received: from W0053328.mgh.harvard.edu.partners.org ([132.183.29.121]) by PHSXMB8.partners.org with Microsoft SMTPSVC(6.0.3790.3959); Tue, 27 Nov 2007 17:00:40 -0500 In-Reply-To: <871wabv0bf.fsf@thievol.homelinux.org> (Thierry Volpiatto's message of "Tue, 27 Nov 2007 22:35:32 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-OriginalArrivalTime: 27 Nov 2007 22:00:40.0702 (UTC) FILETIME=[F32511E0:01C83140] X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:49596 Archived-At: Thierry Volpiatto writes: > jadamson@partners.org (Joel J. Adamson) writes: > >> reader@newsguy.com writes: >> >>> Eli Zaretskii writes: >>> >>>> You should be able to use the \, construct to invoke `format' or some >>>> similar function and advance the counter. See the example in >>> >>> Thats not available in dired either is it? >> >> M-x wdired-change-to-wdired-mode >> >> and then you can edit filenames freely as you would edit a file, >> i.e. you can use any of the search and replace functions. To rename >> files sequentially, as long as they are in the order you expect them to >> be, you can use a regex with "\#" which represents the number of >> substitutions. >> >> Joel > > It work really well with "\#", thank you Joel. [...] You're welcome, I'm glad to help. > So which one is the counter, "\" or "#" ? > `\' and `#' together are a symbol meaning a counter in a replacement pattern. `\,' is the construct that says "LISP IS COMING!" In case I failed to mention, I often use `(string-to-int \1)' for addition, e.g. \,(+ \# (string-to-int \1)) to add number of replacements to the captured regex. Joel -- Joel J. Adamson Biostatistician Pediatric Psychopharmacology Research Unit Massachusetts General Hospital Boston, MA 02114 (617) 643-1432 (303) 880-3109 The information transmitted in this electronic communication is intended only for the person or entity to whom it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this information in error, please contact the Compliance HelpLine at 800-856-1983 and properly dispose of this information.