commnad shell for exactly copy dir and files - Unix

This is a discussion on commnad shell for exactly copy dir and files - Unix ; from dir XX I want copy all its content inner dir YY; the original folder XX has at its inner other directory, subdirectory and files; which is the correct parameter to use with cp: -r -R -a -p etc.... Which ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: commnad shell for exactly copy dir and files

  1. commnad shell for exactly copy dir and files

    from dir XX I want copy all its content
    inner dir YY;
    the original folder XX has at its inner other directory, subdirectory and
    files;
    which is the correct parameter to use with cp:
    -r
    -R
    -a
    -p
    etc....

    Which to use and which are the difference?

  2. Re: commnad shell for exactly copy dir and files

    In <1pbsg2cip2r3q$.k1pckf5zu5uv.dlg@40tude.net> nawfer writes:

    > from dir XX I want copy all its content
    > inner dir YY;
    > the original folder XX has at its inner other directory, subdirectory and
    > files;
    > which is the correct parameter to use with cp:
    > -r
    > -R
    > -a
    > -p
    > etc....


    > Which to use and which are the difference?


    Let's see if I understand your question.

    You have a directory XX, which contains some files and subdirectories.
    You want to copy all of these contents into the subdirectory YY.

    To avoid the messy situation of copying YY into itself, the easiest
    solution is to make the copy at a different directory level, then move
    the copy into YY when it's done. (If you were to do the copy in-place,
    you'd be replicating YY forever, until you reached the directory length
    limit.)

    Starting in XX:

    cd ..
    cp -r XX XX-Copy
    mv XX-Copy XX/YY/XX

    --
    John Gordon A is for Amy, who fell down the stairs
    gordon@panix.com B is for Basil, assaulted by bears
    -- Edward Gorey, "The Gashlycrumb Tinies"


+ Reply to Thread