Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
From: Helmut Waitzmann <nn.throttle@xoxy.net>
To: info-gnus-english@gnu.org
Subject: Re: nnir with notmuch gives error; Possible solution!
Date: Thu, 26 Mar 2020 20:16:24 +0100	[thread overview]
Message-ID: <877dz7sz8d.fsf@helmutwaitzmann.news.arcor.de> (raw)
In-Reply-To: <87k138i6og.fsf@ericabrahamsen.net>

Eric Abrahamsen <eric@ericabrahamsen.net>:
>physiculus <physiculus@gmail.com> writes:

>> But how could i change the string inside the filename from !2 
>> to :2 ? Perhaps with dired, but i dont know how?
>
>Dired has wdired-mode that allows you to edit file names in the 
>dired buffer as though they were plain text, and then "commit" 
>all the renames at once. If you have a small number of files to 
>rename or they're all in the same directory that would be most 
>straightforward. If these files are scattered through a very 
>large number of directories you'll probably want to do it in the 
>shell, probably with find and exec and mv.

As physiculus apparently uses a linux system, I assume, that 
"find" will be GNU "find", "ls" will be GNU "ls", and a "bash" 
will be available. 

   (
     cd -- /the/nndir/directory/hierarchy &&
     find . -depth -name '*!*' \
       ! -exec bash -c -- '
         curname="${1##*/}" && dir="${1%"$curname"}" &&
         newname="${curname//!/:}" &&
         if test -e "${dir}${newname}" ||
           test -L "${dir}${newname}"
         then
           # The file to be renamed to already exists!
           # What should be done?  Let the user decide:
           cd -- "$dir" &&
           printf %s\\n \
             '\''current subdirectory:'\'' \
             "$dir" \
             '\''The file to be renamed to,'\'' \
             "$newname" '\''already exists!'\'' \
             '\''Please enter shell commands to resolve'\'' \
             '\''that situation.  For your convenience,'\'' \
             '\''the current file'"'s"' name is in the'\'' \
             '\''positional parameter "$1", while the new'\'' \
             '\''one is in the positional parameter "$2".'\'' \
             '\''For example, try the commands'\'' \
             '\''  ls -QF1logd -- "$1" "$2"'\'' \
             and \
             '\''  mv -i -- "$1" "$2"'\'' \
             '\''Type the command "exit" when finished.'\'' &&
           ls -QFlogdU -- "$curname" "$newname" &&
           "${SHELL}" -sim -- "$curname" "$newname"
         else
           # REMOVE THE FOLLOWING LINE STARTING WITH "printf" TO
           # ACTUALLY LET THIS COMMAND MOVE FILES:
           printf '%q\n' \
           mv -- "${dir}${curname}" "${dir}${newname}"
         fi' bash \{\} \;
   )

Not tested, though, therefore the actual "mv" command will only be 
printed rather than executed.  See the comment written in 
capitals, above.



_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

  reply	other threads:[~2020-03-26 19:16 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-12 18:27 nnir with notmuch gives error; sort: Wrong type argument: number-or-marker-p, nil physiculus
2020-03-12 19:09 ` Eric Abrahamsen
2020-03-13  9:46   ` physiculus
2020-03-13 17:04     ` xuqi
2020-03-14  7:52       ` physiculus
2020-03-14 11:30         ` xuqi
2020-03-14 15:31           ` physiculus
2020-03-14 16:11             ` Eric Abrahamsen
2020-03-14 16:23               ` physiculus
2020-03-14 16:47                 ` Eric Abrahamsen
2020-03-15 11:45                   ` physiculus
2020-03-15 18:50                     ` xuqi
2020-03-16 18:42                       ` physiculus
2020-03-16 19:42                         ` Eric Abrahamsen
2020-03-17  8:50                           ` physiculus
2020-03-17 14:22                             ` physiculus
2020-03-18  1:27                               ` xuqi
2020-03-18 18:02                                 ` physiculus
2020-03-19 22:56                                   ` Eric Abrahamsen
2020-03-25 19:05                           ` nnir with notmuch gives error; Possible solution! physiculus
2020-03-25 19:19                             ` Eric Abrahamsen
2020-03-26 19:16                               ` Helmut Waitzmann [this message]
2020-03-15 22:09                     ` nnir with notmuch gives error; sort: Wrong type argument: number-or-marker-p, nil Eric Abrahamsen
2020-03-13 18:51     ` Eric Abrahamsen
2020-03-14  7:54       ` physiculus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877dz7sz8d.fsf@helmutwaitzmann.news.arcor.de \
    --to=nn.throttle@xoxy.net \
    --cc=info-gnus-english@gnu.org \
    --cc=oe.throttle@xoxy.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).