[Top][All Lists]

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

Re: isearch-rename-all-matching-filenames-in-tree?

From: Thomas L Roche
Subject: Re: isearch-rename-all-matching-filenames-in-tree?
Date: Mon, 14 Oct 2002 19:09:44 -0400

I wrote:
>> Use case: I'm in a dired buffer in GNU Emacs 21.1.1 on w2k. I
>> want to _interactively_ rename any file

>> - in the directory tree below the current directory

>> - with name matching '*GenericAction*'

>> to '*ActionClass*', in the same directory.

Stefan Monnier replied:
> Try wdired, it's great for those kind of things.

While it does appear to be a very nice tool (and I've already
installed it), it doesn't quite solve this use case, because
dired won't show all matching files in the tree (just in the
current directory). But

Wojciech Komornicki suggested:
> Here is what I do
>   1) Do a find-dired interactively with
>       M-x find-dired <RET>
>      When prompted for the args enter
>           -name \*GenericAction\*

which is the other part of the puzzle. (find-name-dired solves my
use case with slightly less typing.)

>      This will give you a listing of all the GenericAction files

>   2) Record a keyboard macro to do the following
>   a) C-SPC     -- set a mark at a file name
>   b) C-e       -- go to end of line
>   c) M-w       -- copy the region to the kill buffer
>   d) R         -- rename the file
>   e) C-y       -- yank back the name of the current file
>   f) C-r GenericAction -- this will place the cursor at the G of
>                   GenericAction
>   g) <right arrow> -- use right arrow to go past Action
>   h) Class <RET> -- to enter Class after Action and rename the file
>   i) n         -- go to the next file

>    3) Once you have this macro recorded, replay the macro with
>         C-u 9999 C-x e

> If you do not have more than 10000 files this is all the
> keysrokes you need.

However I definitely prefer 'wdired' to the macro approach.

Thanks all!

reply via email to

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