help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Easy way to rename files sequentially?


From: Joel J. Adamson
Subject: Re: Easy way to rename files sequentially?
Date: Tue, 27 Nov 2007 17:00:38 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Thierry Volpiatto <thierry.volpiatto@gmail.com> writes:

> jadamson@partners.org (Joel J. Adamson) writes:
>
>> reader@newsguy.com writes:
>>
>>> Eli Zaretskii <eliz@gnu.org> 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.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]