tar.tar - Linux

This is a discussion on tar.tar - Linux ; Ok I've been downloading my tarballs with winXP. I use ut for most of my networking and linux for development. I have all these files called .tar.tar How do I use mv to change them to .tar.gz ? Mv responds ...

+ Reply to Thread
Results 1 to 11 of 11

Thread: tar.tar

  1. tar.tar

    Ok I've been downloading my tarballs with winXP. I use ut for most of my
    networking and linux for development. I have all these files called .tar.tar
    How do I use mv to change them to .tar.gz ? Mv responds with second option
    must be a directory. Am I missing a switch anywahere to mv ?

    Bill



  2. Re: tar.tar

    On Mon, 18 Dec 2006 20:52:22 +0000, Bill Cunningham wrote:

    > Ok I've been downloading my tarballs with winXP. I use ut for most of my
    > networking and linux for development. I have all these files called .tar.tar
    > How do I use mv to change them to .tar.gz ? Mv responds with second option
    > must be a directory. Am I missing a switch anywahere to mv ?


    You don't rename files with mv.

    man rename.

  3. Re: tar.tar

    > man rename.

    I tried the man page. Unless I was overlooking something it didn't help.
    I'll check again.

    Bill



  4. Re: tar.tar



    On Mon, 18 Dec 2006, Ivan Marsh wrote:

    > On Mon, 18 Dec 2006 20:52:22 +0000, Bill Cunningham wrote:
    >
    >> Ok I've been downloading my tarballs with winXP. I use ut for most of my
    >> networking and linux for development. I have all these files called .tar.tar
    >> How do I use mv to change them to .tar.gz ? Mv responds with second option
    >> must be a directory. Am I missing a switch anywahere to mv ?

    >
    > You don't rename files with mv.


    Are you sure about this?

    >
    > man rename.


    From the Linux man page:
    ==============
    MV(1) FSF
    MV(1)

    NAME
    mv - move (rename) files

    ==============

    mv will certainly rename files on any Linux and Solaris system. Ah, I see
    the problem: the OP is trying to rename multiple files. Solution:

    /bin/bash
    for file in *.tar.tar ; do mv $file `basename $file .tar`.gz; done


    >


  5. Re: tar.tar

    Bill Cunningham wrote:

    > Ok I've been downloading my tarballs with winXP. I use ut for most of my
    > networking and linux for development. I have all these files called .tar.tar
    > How do I use mv to change them to .tar.gz ? Mv responds with second option
    > must be a directory. Am I missing a switch anywahere to mv ?


    No, misunderstanding how mv works:

    mv moves the link of the file from the first directory entry to the second
    directory entry (or copies and unlinks if across filesystems). mv can
    accept more than 2 arguments in which case it means move all the specified
    files (arguments except the last) into the directory (specified as the last
    argument).

    You're easiest option is to use rename:

    $ rename .tar.tar .tar.gz *.tar.tar

    Note that if you tried:

    $ rename .tar .gz *.tar

    you would effect the change:

    a.tar.tar -> a.gz.tar

    as rename changes the first occurance of the source string.


  6. Re: tar.tar

    On Mon, 18 Dec 2006 15:52:37 -0800, Whoever wrote:

    > On Mon, 18 Dec 2006, Ivan Marsh wrote:
    >> On Mon, 18 Dec 2006 20:52:22 +0000, Bill Cunningham wrote:
    >>
    >>> Ok I've been downloading my tarballs with winXP. I use ut for most of my
    >>> networking and linux for development. I have all these files called .tar.tar
    >>> How do I use mv to change them to .tar.gz ? Mv responds with second option
    >>> must be a directory. Am I missing a switch anywahere to mv ?

    >>
    >> You don't rename files with mv.

    >
    > Are you sure about this?
    >
    >>
    >> man rename.

    >
    > From the Linux man page:
    > ==============
    > MV(1) FSF
    > MV(1)
    >
    > NAME
    > mv - move (rename) files
    >
    > ==============
    >
    > mv will certainly rename files on any Linux and Solaris system. Ah, I see
    > the problem: the OP is trying to rename multiple files. Solution:
    >
    > /bin/bash
    > for file in *.tar.tar ; do mv $file `basename $file .tar`.gz; done


    ....or simply use rename.

  7. Re: tar.tar


    > Are you sure about this?
    >
    >>
    >> man rename.

    >
    > From the Linux man page:
    > ==============
    > MV(1) FSF MV(1)
    >
    > NAME
    > mv - move (rename) files
    >
    > ==============
    >
    > mv will certainly rename files on any Linux and Solaris system. Ah, I see
    > the problem: the OP is trying to rename multiple files. Solution:
    >
    > /bin/bash
    > for file in *.tar.tar ; do mv $file `basename $file .tar`.gz; done


    Exactly. I am trying to rename all the files *.tar.tar to *.tar.gz. I've
    always used mv to rename files and never rename. In fact I've never have
    heard of rename of linux. Never looked I guess. Now I've never tried to
    rename more than one file with mv. Could you explain the above bash script a
    little more clearly? Do i literally type "mv $file.." I dont do bash
    scripting.

    Bill



  8. Re: tar.tar

    On Tue, 19 Dec 2006 21:08:22 +0000, Bill Cunningham wrote:

    >
    >> Are you sure about this?
    >>
    >>>
    >>> man rename.

    >>
    >> From the Linux man page:
    >> ==============
    >> MV(1) FSF MV(1)
    >>
    >> NAME
    >> mv - move (rename) files
    >>
    >> ==============
    >>
    >> mv will certainly rename files on any Linux and Solaris system. Ah, I see
    >> the problem: the OP is trying to rename multiple files. Solution:
    >>
    >> /bin/bash
    >> for file in *.tar.tar ; do mv $file `basename $file .tar`.gz; done

    >
    > Exactly. I am trying to rename all the files *.tar.tar to *.tar.gz. I've
    > always used mv to rename files and never rename. In fact I've never have
    > heard of rename of linux. Never looked I guess. Now I've never tried to
    > rename more than one file with mv. Could you explain the above bash script a
    > little more clearly? Do i literally type "mv $file.." I dont do bash
    > scripting.
    >
    > Bill


    That makes sense... write a script to replace an existing command... okay,
    I'm out.

  9. Re: tar.tar



    On Tue, 19 Dec 2006, Bill Cunningham wrote:

    >
    >> Are you sure about this?
    >>
    >>>
    >>> man rename.

    >>
    >> From the Linux man page:
    >> ==============
    >> MV(1) FSF MV(1)
    >>
    >> NAME
    >> mv - move (rename) files
    >>
    >> ==============
    >>
    >> mv will certainly rename files on any Linux and Solaris system. Ah, I see
    >> the problem: the OP is trying to rename multiple files. Solution:
    >>
    >> /bin/bash
    >> for file in *.tar.tar ; do mv $file `basename $file .tar`.gz; done

    >
    > Exactly. I am trying to rename all the files *.tar.tar to *.tar.gz. I've
    > always used mv to rename files and never rename. In fact I've never have
    > heard of rename of linux. Never looked I guess. Now I've never tried to
    > rename more than one file with mv. Could you explain the above bash script a
    > little more clearly? Do i literally type "mv $file.." I dont do bash
    > scripting.


    Yes, you type it exactly as I showed. To break it down:

    for file in *.tar.tar ;
    # Gets a list of files name "*.tar.tar", and executes a loop, with
    # "file" as the variable name that holds the file name in each iteration
    # of the loop
    do mv $file `basename $file .tar`.gz;
    # `basename $file .tar` returns the filename (which was held in $file
    # with the ".tar" stripped off. We then rename the file name in $file to
    # the stripped name + .gz
    done
    # finish the loop





    >
    > Bill
    >
    >
    >


  10. Re: tar.tar



    On Tue, 19 Dec 2006, Ivan Marsh wrote:

    > On Tue, 19 Dec 2006 21:08:22 +0000, Bill Cunningham wrote:
    >
    >>
    >>> Are you sure about this?
    >>>
    >>>>
    >>>> man rename.
    >>>
    >>> From the Linux man page:
    >>> ==============
    >>> MV(1) FSF MV(1)
    >>>
    >>> NAME
    >>> mv - move (rename) files
    >>>
    >>> ==============
    >>>
    >>> mv will certainly rename files on any Linux and Solaris system. Ah, I see
    >>> the problem: the OP is trying to rename multiple files. Solution:
    >>>
    >>> /bin/bash
    >>> for file in *.tar.tar ; do mv $file `basename $file .tar`.gz; done

    >>
    >> Exactly. I am trying to rename all the files *.tar.tar to *.tar.gz. I've
    >> always used mv to rename files and never rename. In fact I've never have
    >> heard of rename of linux. Never looked I guess. Now I've never tried to
    >> rename more than one file with mv. Could you explain the above bash script a
    >> little more clearly? Do i literally type "mv $file.." I dont do bash
    >> scripting.
    >>
    >> Bill

    >
    > That makes sense... write a script to replace an existing command... okay,
    > I'm out.


    While the for loop may not be the simplest solution, it's one of those
    "give a man a fish/teach him to fish" issues. If the OP learns to script
    with BASH, what he can do is not limited by the commands on the system.

    >


  11. Re: tar.tar

    On Wed, 20 Dec 2006 19:33:01 -0800, Whoever wrote:

    >
    >
    > On Tue, 19 Dec 2006, Ivan Marsh wrote:
    >
    >> On Tue, 19 Dec 2006 21:08:22 +0000, Bill Cunningham wrote:
    >>
    >>>
    >>>> Are you sure about this?
    >>>>
    >>>>>
    >>>>> man rename.
    >>>>
    >>>> From the Linux man page:
    >>>> ==============
    >>>> MV(1) FSF MV(1)
    >>>>
    >>>> NAME
    >>>> mv - move (rename) files
    >>>>
    >>>> ==============
    >>>>
    >>>> mv will certainly rename files on any Linux and Solaris system. Ah, I see
    >>>> the problem: the OP is trying to rename multiple files. Solution:
    >>>>
    >>>> /bin/bash
    >>>> for file in *.tar.tar ; do mv $file `basename $file .tar`.gz; done
    >>>
    >>> Exactly. I am trying to rename all the files *.tar.tar to *.tar.gz. I've
    >>> always used mv to rename files and never rename. In fact I've never have
    >>> heard of rename of linux. Never looked I guess. Now I've never tried to
    >>> rename more than one file with mv. Could you explain the above bash script a
    >>> little more clearly? Do i literally type "mv $file.." I dont do bash
    >>> scripting.
    >>>
    >>> Bill

    >>
    >> That makes sense... write a script to replace an existing command... okay,
    >> I'm out.

    >
    > While the for loop may not be the simplest solution, it's one of those
    > "give a man a fish/teach him to fish" issues. If the OP learns to script
    > with BASH, what he can do is not limited by the commands on the system.


    Learning to write scripts is just dandy... writing one when you don't need
    to is a waste of time.

    --
    The USA Patriot Act is the most unpatriotic act in American history.
    Feingold-Obama '08 - Because the Constitution isn't history,
    It's the law.


+ Reply to Thread