From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xavier Maillard Newsgroups: gmane.emacs.help Subject: Howto rename a file Date: Tue, 06 Dec 2005 01:02:51 +0100 Message-ID: Reply-To: zedek@gnu-rox.org NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1133828175 18036 80.91.229.2 (6 Dec 2005 00:16:15 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 6 Dec 2005 00:16:15 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Dec 06 01:16:14 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EjQTt-0008A4-Qp for geh-help-gnu-emacs@m.gmane.org; Tue, 06 Dec 2005 01:14:54 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EjQU1-0001yj-21 for geh-help-gnu-emacs@m.gmane.org; Mon, 05 Dec 2005 19:15:01 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EjQLo-0000sg-E0 for help-gnu-emacs@gnu.org; Mon, 05 Dec 2005 19:06:32 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EjQLm-0000ql-Mx for help-gnu-emacs@gnu.org; Mon, 05 Dec 2005 19:06:31 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EjQLj-0000qC-HF for help-gnu-emacs@gnu.org; Mon, 05 Dec 2005 19:06:29 -0500 Original-Received: from [213.41.184.169] (helo=smtp.gnu-rox.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EjQMI-0006cg-AC; Mon, 05 Dec 2005 19:07:02 -0500 Original-Received: from localhost.localdomain (unknown [10.0.0.7]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gnu-rox.org (Postfix) with ESMTP id D73448BBFB; Tue, 6 Dec 2005 01:08:57 +0100 (CET) Original-Received: from zedek by localhost.localdomain with local (Exim 4.60) (envelope-from ) id 1EjQIF-0002zE-Fa; Tue, 06 Dec 2005 01:02:51 +0100 Original-To: help-gnu-emacs@gnu.org User-Agent: RMAIL/GNU Emacs 22.0.50.1 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:31696 Archived-At: Hello, Given the situation I have files in a directory such as foo-1, foo-2 ... When I use an Emacs batch session, I want these files to be renamed as bar-1, bar-2 and so on. In certain cases, I may have other files named foo-1 that should be renamed, following this logic, as bar-1. What I want is that if a file bar-1 already exists, then the file should be renamed as bar- where is a unique number following the maximum found in the directory. So foo-1 will be renamed as bar-3 in my example. How would you do that=A0? Thank you Xavier