• mistaken mv

    From Russell L. Harris@3:633/10 to All on Friday, February 20, 2026 05:40:01
    In a directory with directories blog-1, blog-2, ... , blog-9, I was
    trying to rename the directories, but I accidentally hit the RETURN
    key after typing only "mv blog-*". Now, blog-1, blog-2, ... , blog-8
    have disappeared, but blog-9 remains.

    Where did I send the directories?

    RLH

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From David Christensen@3:633/10 to All on Friday, February 20, 2026 05:50:01
    On 2/19/26 20:30, Russell L. Harris wrote:
    In a directory with directories blog-1, blog-2, ... , blog-9, I was
    trying to rename the directories, but I accidentally hit the RETURN
    key after typing only "mv blog-*".˙ Now, blog-1, blog-2, ... , blog-8
    have disappeared, but blog-9 remains.

    Where did I send the directories?

    RLH


    blog-1 through blog-8 should be in directory blog-9.


    David

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Russell L. Harris@3:633/10 to All on Friday, February 20, 2026 06:00:01
    On Thu, Feb 19, 2026 at 08:43:52PM -0800, David Christensen wrote:
    On 2/19/26 20:30, Russell L. Harris wrote:
    In a directory with directories blog-1, blog-2, ... , blog-9, I was
    trying to rename the directories, but I accidentally hit the RETURN
    key after typing only "mv blog-*".?? Now, blog-1, blog-2, ... , blog-8
    have disappeared, but blog-9 remains.

    Where did I send the directories?

    RLH


    blog-1 through blog-8 should be in directory blog-9.


    David

    So they are! I thank you, David. You have saved me much grief.

    From now on, I need to type in "xmv ..." and backspace to remove the x
    only once my arguments are correct.

    RLH

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From David Christensen@3:633/10 to All on Friday, February 20, 2026 06:30:01
    On 2/19/26 20:53, Russell L. Harris wrote:
    On Thu, Feb 19, 2026 at 08:43:52PM -0800, David Christensen wrote:
    On 2/19/26 20:30, Russell L. Harris wrote:
    In a directory with directories blog-1, blog-2, ... , blog-9, I was
    trying to rename the directories, but I accidentally hit the RETURN
    key after typing only "mv blog-*".?? Now, blog-1, blog-2, ... , blog-8
    have disappeared, but blog-9 remains.
    <snip>

    blog-1 through blog-8 should be in directory blog-9.

    <snip>

    So they are!˙ I thank you, David.˙ You have saved me much grief.

    From now on, I need to type in "xmv ..." and backspace to remove the x
    only once my arguments are correct.


    I am glad it worked out for you. :-)


    If you are comfortable with Perl, you might want to take a look at the rename(1p) command (provided by the Debian package "rename"):

    https://manpages.debian.org/trixie/rename/prename.1p.en.html


    David

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chime Hart@3:633/10 to All on Friday, February 20, 2026 06:50:01
    Hi David: You mention "rename" when I was in DOS they had an "ren" which I wish
    I had in Debian, as it handled wild-cards really well. I could type
    ren *.txt *.cnn
    Sure wish we had something simple like that. Thanks in advance
    Chime

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Russell L. Harris@3:633/10 to All on Friday, February 20, 2026 07:10:01
    On Thu, Feb 19, 2026 at 09:45:23PM -0800, Chime Hart wrote:
    Hi David: You mention "rename" when I was in DOS they had an "ren" which I wish
    I had in Debian, as it handled wild-cards really well. I could type
    ren *.txt *.cnn
    Sure wish we had something simple like that. Thanks in advance
    Chime


    Check out the Perl rename utility (written by Larry Wall) which has
    been renamed "file-rename".

    Everyone ought have a copy of the wonderful O'Reilly book "Learning
    Perl".

    RLH

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Arno Lehmann@3:633/10 to All on Friday, February 20, 2026 08:20:01
    Hi Chime, all,

    Am 20.02.2026 um 06:45 schrieb Chime Hart:
    Hi David: You mention "rename" when I was in DOS they had an "ren" which I wish
    I had in Debian, as it handled wild-cards really well. I could type
    ren *.txt *.cnn

    Which is because the DOS shell did not do the wildcard expansion but the
    ren command did. Well, if you're living in a world of 8.3 filenames,
    short command line length limits, and no history of powerfull shell programs...

    Sure wish we had something simple like that. Thanks in advance

    Have a look at the program mmv. The alternative, of course, is to just
    get used to complex shell commands where you just loop through things.

    Cheers,

    Arno

    Chime


    --
    Arno Lehmann

    IT-Service Lehmann
    Sandstr. 6, 49080 Osnabrck

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From covici@3:633/10 to All on Friday, February 20, 2026 10:40:01
    Try mmv it works great, but you need to read its manual carefully.


    -----Original Message-----
    From: Chime Hart <chime@hubert-humphrey.com>
    Sent: Friday, February 20, 2026 12:45 AM
    To: David Christensen <dpchrist@holgerdanske.com>
    Cc: debian-user@lists.debian.org
    Subject: Re: mistaken mv

    Hi David: You mention "rename" when I was in DOS they had an "ren" which I
    wish
    I had in Debian, as it handled wild-cards really well. I could type
    ren *.txt *.cnn
    Sure wish we had something simple like that. Thanks in advance
    Chime

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Michael P. Soulier@3:633/10 to All on Friday, February 20, 2026 13:10:01


    On 2026-02-20 01:00, Russell L. Harris wrote:
    Check out the Perl rename utility (written by Larry Wall) which has
    been renamed "file-rename".

    Everyone ought have a copy of the wonderful O'Reilly book "Learning
    Perl".

    If you want to start writing your own utilities, any decent language
    will do. Some have better support libraries than others. The recommended "Camel book" is excellent though.

    But the core problem here was not understanding shell expansion, and a
    lack of confirmation.

    Understand that unlike on DOS, Unix programs do not need to interpret wildcards like *. The shell does that. So when you type
    mv *.txt foo, your shell expands *.txt and mv only sees the result.

    ren *.txt *.cnn would be tricky. *.txt would expand to all of your .txt
    files in the current directory. *.cnn would be passed into your ren
    program only if you have no .cnn files in the current directory.
    Otherwise you would have to escape shell expansion by typing \*.cnn,
    which is not very friendly to use.

    I much prefer the unix approach, but I'm used to it.

    If you start writing your own utilities, use version control for your
    entire home shell setup. I can't recommend that more. I use Git for everything, so now setting up a new login on a new box, or syncing up my config on each box, is a simple git pull followed by a make install.

    Cheers,
    Mike

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Greg Wooledge@3:633/10 to All on Friday, February 20, 2026 13:20:02
    On Thu, Feb 19, 2026 at 21:45:23 -0800, Chime Hart wrote:
    Hi David: You mention "rename" when I was in DOS they had an "ren" which I wish
    I had in Debian, as it handled wild-cards really well. I could type
    ren *.txt *.cnn
    Sure wish we had something simple like that. Thanks in advance

    hobbit:~$ cd /tmp
    hobbit:/tmp$ touch 1.foo 2.foo 3.foo
    hobbit:/tmp$ rename 's/\.foo$/.bar/' *.foo
    hobbit:/tmp$ ls -l [123]*
    -rw-rw-r-- 1 greg greg 0 Feb 20 07:16 1.bar
    -rw-rw-r-- 1 greg greg 0 Feb 20 07:16 2.bar
    -rw-rw-r-- 1 greg greg 0 Feb 20 07:16 3.bar

    It's not quite as simple as you wanted, but it'll get the job done.
    There's a great deal *more* it can do as well.

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Nicolas George@3:633/10 to All on Friday, February 20, 2026 13:30:01
    Greg Wooledge (HE12026-02-20):
    hobbit:/tmp$ touch 1.foo 2.foo 3.foo
    hobbit:/tmp$ rename 's/\.foo$/.bar/' *.foo

    Or:

    zmv '(*).foo' '$1.bar'

    Regards,

    --
    Nicolas George

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Michael P. Soulier@3:633/10 to All on Friday, February 20, 2026 13:40:01
    On 2026-02-20 07:31, Thomas Schmitt wrote:
    I have to nitpick:

    While this non-interpration of wildcards is true for programs like cp
    or mv, other programs interpret wildcards if they appear in arguments.
    In this case the shell has to be kept from expanding the wildcards.

    Which I did mention further down in my post.

    Mike

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Michael P. Soulier@3:633/10 to All on Friday, February 20, 2026 13:40:01
    On 2026-02-20 07:19, Greg Wooledge wrote:
    hobbit:~$ cd /tmp
    hobbit:/tmp$ touch 1.foo 2.foo 3.foo
    hobbit:/tmp$ rename 's/\.foo$/.bar/' *.foo
    hobbit:/tmp$ ls -l [123]*
    -rw-rw-r-- 1 greg greg 0 Feb 20 07:16 1.bar
    -rw-rw-r-- 1 greg greg 0 Feb 20 07:16 2.bar
    -rw-rw-r-- 1 greg greg 0 Feb 20 07:16 3.bar

    It's not quite as simple as you wanted, but it'll get the job done.
    There's a great deal *more* it can do as well.

    Personally since I'm comfy with Vi, I like vidir. Just edit the
    directory as if it were a .txt file and save.

    Mike

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chime Hart@3:633/10 to All on Friday, February 20, 2026 14:50:01
    Thank you all in these 2 threads, I will check out file-rename-and-I just installed "mmv" And speaking of wild-cards, unzip will not handle them, but "unp" will nicely.
    Chime

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Nicolas George@3:633/10 to All on Friday, February 20, 2026 15:00:01
    Chime Hart (HE12026-02-20):
    And speaking of wild-cards, unzip will not handle them

    Just checked, it absolutely handles them. ? will let it extract files
    named a and b but not cd.

    What did you try exactly?

    Regards,

    --
    Nicolas George

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Greg Wooledge@3:633/10 to All on Friday, February 20, 2026 15:00:01
    On Fri, Feb 20, 2026 at 14:53:19 +0100, Nicolas George wrote:
    Chime Hart (HE12026-02-20):
    And speaking of wild-cards, unzip will not handle them

    Just checked, it absolutely handles them. ? will let it extract files
    named a and b but not cd.

    Confirmed:

    hobbit:~$ cd /tmp
    hobbit:/tmp$ touch 1.foo 2.foo 1.bar 2.bar
    hobbit:/tmp$ zip foobar.zip *.foo *.bar
    adding: 1.foo (stored 0%)
    adding: 2.foo (stored 0%)
    adding: 1.bar (stored 0%)
    adding: 2.bar (stored 0%)
    hobbit:/tmp$ unzip -v foobar.zip '*.foo'
    Archive: foobar.zip
    Length Method Size Cmpr Date Time CRC-32 Name
    -------- ------ ------- ---- ---------- ----- -------- ----
    0 Stored 0 0% 2026-02-20 08:54 00000000 1.foo
    0 Stored 0 0% 2026-02-20 08:54 00000000 2.foo
    -------- ------- --- -------
    0 0 0% 2 files
    hobbit:/tmp$ unzip -v foobar.zip '1.*'
    Archive: foobar.zip
    Length Method Size Cmpr Date Time CRC-32 Name
    -------- ------ ------- ---- ---------- ----- -------- ----
    0 Stored 0 0% 2026-02-20 08:54 00000000 1.foo
    0 Stored 0 0% 2026-02-20 08:54 00000000 1.bar
    -------- ------- --- -------
    0 0 0% 2 files

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chime Hart@3:633/10 to All on Friday, February 20, 2026 15:20:01
    Well Nicolas, when I ran
    unzip *.zip
    it only handled the first file, unlike unp which handled all zip files. I didn't use any switches, but I should say I am in TCSH, if that changes things. Chime

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Nicolas George@3:633/10 to All on Friday, February 20, 2026 15:30:01
    Chime Hart (HE12026-02-20):
    unzip *.zip
    it only handled the first file, unlike unp which handled all zip files.

    unzip never saw the wildcard, it saw the list of zip files expanded by
    the shell from the wildcard.

    Also, unzip is not designed to extract from multiple archives. The first argument is the name of the archive. The other arguments are patterns
    for the files to extract.

    So basically, you tried to extract 2.zip and 3.zip from 1.zip.

    didn't use any switches, but I should say I am in TCSH, if that changes things.

    It changes a lot of things, but not here.

    One of the things it changes is that globs that do not match any local
    file will cause an error instead of being kept as is. This is one of the
    rare instance where the behavior of tcsh is sane and the behavior of sh
    and derived is insane.

    For a sane glob behavior with the syntax of Bourne shells, use zsh.

    Regards,

    --
    Nicolas George

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Greg Wooledge@3:633/10 to All on Friday, February 20, 2026 15:40:01
    On Fri, Feb 20, 2026 at 06:10:53 -0800, Chime Hart wrote:
    Well Nicolas, when I ran
    unzip *.zip
    it only handled the first file, unlike unp which handled all zip files.

    That's because of how the unzip command's syntax is constructed, and
    how the shell handles wildcards.

    The first and most important thing is that the SHELL is expanding
    that wildcard, because you didn't quote it. If you have two .zip
    files in the current directory, then your command expands to

    unzip file1.zip file2.zip

    Next, we look at the synopsis for unzip:

    hobbit:~$ unzip
    UnZip 6.00 of 20 April 2009, by Debian. Original by Info-ZIP.

    Usage: unzip [-Z] [-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]
    Default action is to extract files in list, except those in xlist, to exdir;
    file[.zip] may be a wildcard. -Z => ZipInfo mode ("unzip -Z" for usage).

    The syntax only allows a single zip file to be specified. Any other
    filenames that follow it are part of the "list", which is the set of
    filenames (or patterns) to be extracted. Therefore, your command has
    the following semantics:

    Extract from the archive "file1.zip"
    Limit extraction to the file(s) named "file2.zip"

    You'll find that tar works the same way -- you can only specify a single archive to extract, but multiple file-matching patterns to extract from
    that single archive.

    If you want to give a pattern to unzip, or tar, or find, or mmv, or any
    other command that handles file-matching patterns on its own, then you
    must quote the pattern to avoid having the shell expand it.

    unzip file.zip *.txt # wrong
    unzip file.zip '*.txt' # right

    Remember also, the three forms of quoting in Bourne shells are single
    quotes, double quotes, and backslashes. In this context, any of those
    three will work.

    unzip file.zip "*.txt" # also right
    unzip file.zip \*.txt # also right

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Greg Wooledge@3:633/10 to All on Friday, February 20, 2026 16:10:01
    On Fri, Feb 20, 2026 at 06:52:34 -0800, Chime Hart wrote:
    Hi Greg: All your examples make sense, but you either haven't installed unp or
    are not familliar with it?

    I'm not familiar with it. The man page at
    <https://manpages.debian.org/unp> is a bit terse.

    I find it quite helpful when extracting multiple
    .rar files, however, it works better if I were to run
    unp *part01.rar
    if I use *.rar it will seemingly go in a loop-and-extract individual files a
    2nd time.

    I haven't dealt with rar archives often, but with large archives that
    get split into many files, aren't the secondary parts stored in files
    with extensions like .r01 and so on? I thought .rar was only used for
    the first file in each archive.

    What kinds of files are you actually dealing with here? What are their
    names and how are they related to each other?

    As far as extracting entire multiple archives in a single command --
    that's just not a common practice. If you really need to do that
    (e.g. with multiple standalone .tar.gz files), you'd use a shell loop:

    for f in *.tar.gz; do tar -xf "$f"; done

    (That's Bourne shell syntax.) This use case is rare enough and simple
    enough to work around with a loop that the standard tools don't offer
    special options for it.

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chime Hart@3:633/10 to All on Friday, February 20, 2026 16:10:01
    Hi Greg: All your examples make sense, but you either haven't installed unp or are not familliar with it? I find it quite helpful when extracting multiple .rar files, however, it works better if I were to run
    unp *part01.rar
    if I use *.rar it will seemingly go in a loop-and-extract individual files a 2nd time. I had only found unp when running a search for such a program which would handle wild-cards.
    Chime

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Chime Hart@3:633/10 to All on Friday, February 20, 2026 16:20:01
    Hi Greg: A majority of .rar files I've been extracting were in binary usenet groups. As far as I remember they were never mixed. Either all of them were file.r00-file.r99 or file.rar or file.part01.rar-file.part99.rar. I just took a
    look at man unp says a dash will unpack everthing.
    Chime

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Teemu Likonen@3:633/10 to All on Friday, February 20, 2026 17:50:02
    * 2026-02-19 21:45:23-0800, Chime Hart wrote:
    Hi David: You mention "rename" when I was in DOS they had an "ren" which I wish
    I had in Debian, as it handled wild-cards really well. I could type
    ren *.txt *.cnn
    Sure wish we had something simple like that. Thanks in advance
    Usually not because the "culture" in Linux/Unix world is that
    command-line interpreter (shell) handles filename expansion, variable
    expansion and various other expansions. Simple commands don't expand
    anything; they just take filenames.
    One may see this as bad but it is also a good thing. Different programs
    don't have different semantics for expansion. When only one component
    (shell) makes all expansions the meaning is clearer and the escape
    technique that prevents the expansion is clear.
    Of course we may need a command to rename all *.txt files to *.cnn
    files. Maybe someone has written a tool for that. We can write our own
    shell loop to do that.
    In Bash shell, which most people use:
    for f in *.txt; do mv "$f" "${f%*.txt}.cnn"; done
    In Fish shell, a bit clearer:
    for f in *.txt; mv $f (path change-extension cnn $f); end

    --
    /// Teemu Likonen - .-.. https://www.iki.fi/tlikonen/
    // OpenPGP: DD3B8E8ABD28B98176E6A7CCCC9A5E615FCC1D93
    / old key: 6965F03973F0D4CA22B9410F0F2CAE0E07608462


    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Nicolas George@3:633/10 to All on Friday, February 20, 2026 19:00:01
    Chime Hart (HE12026-02-20):
    Hi Greg: All your examples make sense, but you either haven't installed unp or
    are not familliar with it? I find it quite helpful when extracting multiple .rar files, however, it works better if I were to run
    unp *part01.rar
    if I use *.rar it will seemingly go in a loop-and-extract individual files a
    2nd time. I had only found unp when running a search for such a program which
    would handle wild-cards.

    Knowing a little shell syntax will get you much farther than knowing one
    script that does the loop for you.

    for i in *.part1.rar ; unrar x $i

    (zsh)

    Regards,

    --
    Nicolas George

    --- PyGate Linux v1.5.11
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)