GNU cpio version 2.5 does not work with ls -R ? Why? - Unix

This is a discussion on GNU cpio version 2.5 does not work with ls -R ? Why? - Unix ; Hi -- I was finding my way around cpio backups, and I tried the trick on a directory that has sub-directories. So I attempted "ls -R" and piped it to cpio. It won't accept the command. Why? --------------------------------------------------------------- $ls -R ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: GNU cpio version 2.5 does not work with ls -R ? Why?

  1. GNU cpio version 2.5 does not work with ls -R ? Why?

    Hi --

    I was finding my way around cpio backups, and I tried the trick on a
    directory that has sub-directories. So I attempted "ls -R" and piped it
    to cpio. It won't accept the command. Why?


    ---------------------------------------------------------------
    $ls -R ./Stallings/ | cpio -ov > /bak/test2
    ---------------------------------------------------------------
    cpio: ./Stallings/:: No such file or directory
    cpio: CPIORESTORE: No such file or directory
    cpio: Java: No such file or directory
    cpio: Java.zip: No such file or directory

    etc...

    $ls -R Stallings/
    Stallings/:
    CPIORESTORE Java Java.zip OS_Notes Pascal Pascal.zip UNIX.pdf

    Stallings/Java:
    F14-Horizontal.pdf F14-Vertical.pdf F5-Horizontal.pdf F5-Vertical.pdf

    etc...

  2. Re: GNU cpio version 2.5 does not work with ls -R ? Why?

    On 2006-03-02, H L wrote:
    > Hi --
    >
    > I was finding my way around cpio backups, and I tried the trick on a
    > directory that has sub-directories. So I attempted "ls -R" and piped it
    > to cpio. It won't accept the command. Why?
    >
    >
    > ---------------------------------------------------------------
    > $ls -R ./Stallings/ | cpio -ov > /bak/test2
    > ---------------------------------------------------------------
    > cpio: ./Stallings/:: No such file or directory
    > cpio: CPIORESTORE: No such file or directory
    > cpio: Java: No such file or directory
    > cpio: Java.zip: No such file or directory
    >
    > etc...
    >
    > $ls -R Stallings/
    > Stallings/:
    > CPIORESTORE Java Java.zip OS_Notes Pascal Pascal.zip UNIX.pdf
    >
    > Stallings/Java:
    > F14-Horizontal.pdf F14-Vertical.pdf F5-Horizontal.pdf F5-Vertical.pdf
    >
    > etc...


    Just look at the output. It's terrible. What you want is a list of
    files, and `ls -R` is meant to be human-readable, not piped directly
    into another process.

    What you're probably looking for is something like "find". Just running
    "find" will list absolutely everything it can find from the current
    directory onwards. If you don't want things like directories or special
    files specifically listed, then do "find -type f" to find only regular
    files. If you don't want to use the current directory, use
    "find -type f ".

    jakob

  3. Re: GNU cpio version 2.5 does not work with ls -R ? Why?

    According to H L :
    :Hi --
    :
    : I was finding my way around cpio backups, and I tried the trick on a
    : directory that has sub-directories. So I attempted "ls -R" and piped it
    : to cpio. It won't accept the command. Why?
    :
    :
    :---------------------------------------------------------------
    :$ls -R ./Stallings/ | cpio -ov > /bak/test2
    :---------------------------------------------------------------
    :cpio: ./Stallings/:: No such file or directory
    :cpio: CPIORESTORE: No such file or directory
    :cpio: Java: No such file or directory
    :cpio: Java.zip: No such file or directory
    :
    :etc...
    :
    :$ls -R Stallings/
    :Stallings/:
    :CPIORESTORE Java Java.zip OS_Notes Pascal Pascal.zip UNIX.pdf
    :
    :Stallings/Java:
    :F14-Horizontal.pdf F14-Vertical.pdf F5-Horizontal.pdf F5-Vertical.pdf
    :
    :etc...

    Did you try it without the option flag -R?

    richk



  4. Re: GNU cpio version 2.5 does not work with ls -R ? Why?

    In di Thu, 02 Mar 2006 08:27:15 +0000, jakob pa grafo (vide:
    www.glosa.org):

    >
    >
    > Just look at the output. It's terrible. What you want is a list of
    > files, and `ls -R` is meant to be human-readable, not piped directly
    > into another process.
    >
    > What you're probably looking for is something like "find".


    Yeah, I know about find. I was wondering why the -R option borked, since
    it's recursive (and seem to be the obvious choice).

  5. Re: GNU cpio version 2.5 does not work with ls -R ? Why?

    On 2006-03-03, H L wrote:
    > In di Thu, 02 Mar 2006 08:27:15 +0000, jakob pa grafo (vide:
    > www.glosa.org):
    >
    >>
    >>
    >> Just look at the output. It's terrible. What you want is a list of
    >> files, and `ls -R` is meant to be human-readable, not piped directly
    >> into another process.
    >>
    >> What you're probably looking for is something like "find".

    >
    > Yeah, I know about find. I was wondering why the -R option borked,


    If didn't; you are using it for something its output is not
    designed for.

    > since it's recursive (and seem to be the obvious choice).


    If you look at the output, you'll see that it is obviously NOT the
    correct choice.

    --
    Chris F.A. Johnson, author |
    Shell Scripting Recipes: | My code in this post, if any,
    A Problem-Solution Approach | is released under the
    2005, Apress | GNU General Public Licence

+ Reply to Thread