From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Peter Dyballa Newsgroups: gmane.emacs.help Subject: Re: Easy way to rename files sequentially? Date: Sun, 25 Nov 2007 22:51:10 +0100 Message-ID: <8CE7C98F-DF7F-44C9-87F4-98AA38B79C08@Web.DE> References: <87ejeexgfy.fsf@celephais.home.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=WINDOWS-1252; delsp=yes; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1196027508 13511 80.91.229.12 (25 Nov 2007 21:51:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 25 Nov 2007 21:51:48 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: cothrige Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Nov 25 22:51:55 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 1IwPOD-0005if-Mg for geh-help-gnu-emacs@m.gmane.org; Sun, 25 Nov 2007 22:51:45 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IwPNy-0005sg-Tg for geh-help-gnu-emacs@m.gmane.org; Sun, 25 Nov 2007 16:51:30 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IwPNj-0005qo-Cf for help-gnu-emacs@gnu.org; Sun, 25 Nov 2007 16:51:15 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IwPNi-0005o1-17 for help-gnu-emacs@gnu.org; Sun, 25 Nov 2007 16:51:15 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IwPNh-0005nj-Og for help-gnu-emacs@gnu.org; Sun, 25 Nov 2007 16:51:13 -0500 Original-Received: from fmmailgate01.web.de ([217.72.192.221]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IwPNh-00076T-GN for help-gnu-emacs@gnu.org; Sun, 25 Nov 2007 16:51:13 -0500 Original-Received: from smtp06.web.de (fmsmtp06.dlan.cinetic.de [172.20.5.172]) by fmmailgate01.web.de (Postfix) with ESMTP id D8134B54E05E; Sun, 25 Nov 2007 22:51:12 +0100 (CET) Original-Received: from [195.4.209.30] (helo=[192.168.1.2]) by smtp06.web.de with asmtp (TLSv1:AES128-SHA:128) (WEB.DE 4.108 #208) id 1IwPNg-0005i3-00; Sun, 25 Nov 2007 22:51:12 +0100 In-Reply-To: <87ejeexgfy.fsf@celephais.home.net> X-Mailer: Apple Mail (2.752.2) X-Sender: Peter_Dyballa@web.de X-Provags-ID: V01U2FsdGVkX18fZ0cpDc9yN2ntZOtsgeA+Is7IP+DWKaOGC1ps B9s5q/lixDxD1p1NumAfGzmOkkZn9dHJmUH3PZkxbfZ6ITldHR NOwgvtpI2mg+l5gxXSAQ== X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 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:49519 Archived-At: Am 25.11.2007 um 20:39 schrieb cothrige: > Is there some relatively easy way to add such a numerical prefix to =20= > a list of files? Does this example from the info pages, Regexp Replacement, help? For example, to add consecutively numbered strings like `ABC00042' to columns 73 to 80 (unless they are already occupied), you can use M-x replace-regexp ^.\{0,72\}$ \,(format "%-72sABC%05d" \& \#) Maybe in your case this works: M-x replace-regexp RET ^.*$ RET \,(format "%03d%s" \# \&) RET i.e. use the complete original file name (\&) and prepend it by a =20 zeroes padded three digit number (\# =3D number of already completed =20 replacements, i.e. starting with 0). The format specification can of =20 course contain additional text. But: dired does not understand \, nor =20= \# in its regular expressions =96 or I am missing something! You could create a shell script instead with code constructed with =20 replace-regexp ... -- Greetings Pete Who the fsck is "General Failure," and why is he reading my disk?