unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to rename files to numbers in Eshell?
@ 2021-09-11 13:15 Felix E. Klee
  2021-09-11 13:40 ` Jean Louis
  2021-09-16 12:15 ` Felix E. Klee
  0 siblings, 2 replies; 38+ messages in thread
From: Felix E. Klee @ 2021-09-11 13:15 UTC (permalink / raw)
  To: help-gnu-emacs

Consider a list of files:

    $ ls -1 *.jpg
    IMG_20210909_0003.jpg
    IMG_20210909_0004.jpg
    IMG_20210909_0005.jpg
    IMG_20210909_0006.jpg
    IMG_20210909_0007.jpg
    …

I want to rename these files to `1.jpg`, `2.jpg`, …, and I know how to
do it with Dired.  However, this time I want to do it with Eshell.

My own attempt, works, but I think there should be an easier way:

    $ listify *.jpg
    $ setq my-files $$
    $ setq my-numbers $(number-sequence 1 (length my-files))
    $ setq my-pairs $(mapcar* 'cons my-files my-numbers)
    $ for pair in $my-pairs { setq a (car pair); setq b (cdr pair);
      mv $a "$b".jpg }

PS: I already posted this on Emacs Stack Exchange
<https://emacs.stackexchange.com/q/68445/5327>.




^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2021-10-04 11:22 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-11 13:15 How to rename files to numbers in Eshell? Felix E. Klee
2021-09-11 13:40 ` Jean Louis
2021-09-12  8:44   ` Felix E. Klee
2021-09-12 19:03     ` Jean Louis
2021-09-13  9:28       ` Jean Louis
2021-09-13 11:52         ` tomas
2021-09-14  7:42         ` Felix E. Klee
2021-09-14  9:17           ` Jean Louis
2021-09-14  9:32             ` tomas
2021-09-14 11:11             ` Felix E. Klee
2021-09-14 13:37               ` Jean Louis
2021-09-14 15:48                 ` Felix E. Klee
2021-09-16 22:37                   ` Michael Heerdegen
2021-09-16 22:47             ` Michael Heerdegen
2021-09-17  7:27               ` Felix E. Klee
2021-09-24  7:21         ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-25 13:43           ` Jean Louis
2021-09-26  2:50             ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-30  6:38         ` Felix E. Klee
2021-09-30  7:37           ` Jean Louis
2021-09-30  7:50             ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-30 13:17             ` Felix E. Klee
2021-09-30 15:34               ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-30 21:42                 ` Jean Louis
2021-10-01  0:09                   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-01 20:51                     ` Jean Louis
2021-10-01 21:34                       ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-02  7:53                         ` Lack of integration in Emacs - it was " Jean Louis
2021-10-03  8:16                           ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-03  9:27                             ` Jean Louis
2021-10-04  3:29                               ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-04 10:15                                 ` Jean Louis
2021-10-04 11:22                                   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-22 14:46       ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-22 14:27   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-16 12:15 ` Felix E. Klee
2021-09-16 15:11   ` Nick Dokos
2021-09-16 16:07     ` Felix E. Klee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).