[Top][All Lists]

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

Re: How to rename files to numbers in Eshell?

From: Emanuel Berg
Subject: Re: How to rename files to numbers in Eshell?
Date: Wed, 22 Sep 2021 16:46:28 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Jean Louis wrote:

> (defun rcd-image-date-match (file)
>   (string-match 
> "[[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][_-]"
>  file))

Badness 1632321754: use the postfix operator for repitition, \{n\}

> (defun sort-images (&optional prefix)

Badness 1632321536: unused lexical argument

>            (dir (concat "/home/data1/protected/Media/Pictures/Pictures/Year-" 
> year "/" month "/" year "-" month "-" day "/"))
>            (destination (concat 
> "/home/data1/protected/Media/Pictures/Pictures/Year-" year "/" month "/" year 
> "-" month "-" day "/" file-base "." file-ext)))

Badness 1632321545: same data hard-coded twice (damn)

>       (mkdir dir t)
>       (message (concat "Copy file to: " destination))

Badness 1632321563: "destination" should be spelled "dst" to
line up with "src", also it is just too long and bulky even
for Lisp.

>           (if (y-or-n-p (concat "Overwrite: " destination))
>               (rename-file file destination t))

Badness 1632321690: `if' with only one branch should be

Conclusion: Hey, no one said it's supposed to be easy ...

underground experts united

reply via email to

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