From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 318 invoked by alias); 6 Sep 2017 08:11:45 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 41644 Received: (qmail 29021 invoked by uid 1010); 6 Sep 2017 08:11:45 -0000 X-Qmail-Scanner-Diagnostics: from 195.159.176.226 by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(195.159.176.226):SA:0(-1.1/5.0):. Processed in 2.444892 secs); 06 Sep 2017 08:11:45 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RDNS_NONE autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: gcszd-zsh-workers@m.gmane.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Injected-Via-Gmane: http://gmane.org/ To: zsh-workers@zsh.org From: Leah Neukirchen Subject: Re: "Edit" files names Date: Wed, 06 Sep 2017 10:11:04 +0200 Message-ID: <87o9qo2qnb.fsf@gmail.com> References: <87pob5ni6e.fsf__34694.9253035293$1504635253$gmane$org@wavexx.thregr.org> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@blaine.gmane.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) In-Reply-To: <87pob5ni6e.fsf__34694.9253035293$1504635253$gmane$org@wavexx.thregr.org> (Yuri D'Elia's message of "Tue, 05 Sep 2017 19:56:09 +0200") Yuri D'Elia writes: > Hi everyone, > > Let's assume I have a garbled file name that I want to rename more > conveniently into an editor, without painful escaping. > > I'd like to do the following: > > $ editname *garbled* > > popping my $EDITOR with a file containing the original file name > (unescaped), and upon saving+closing, renames the original into the new > name provided. If the pattern expands to more files, it just repeats for > each file, in turn. > > It's not hard to implement, but does anybody know of a tool which > already does that (or something very similar)? Not exactly what you asked for, but I like this (uses ZLE): # imv -- interactive rename, using vared imv() { local src dst for src; do [[ -e $src ]] || { print -u2 "$src does not exist"; continue } dst=$src vared dst [[ $src != $dst ]] && mkdir -p $dst:h && mv -n $src $dst && print -s mv -n $src:q:q $dst:q:q # save to history, thus M-. works done } -- Leah Neukirchen http://leah.zone