Results 1 to 6 of 6

Thread: CP Suffix argument Help

  1. #1
    wraith 86 NNTP User

    Default CP Suffix argument Help


    Hey guys, I am hoping someone can help me use the suffix argument in cp.
    I have tried every variation google had to offer and still couldn't get
    it working. The background is that I want a folder copied to a slave
    hard drive each night, however if the same file exists I don't want it
    over written, but to have a number appended to it. I've gone through the
    man pages, but what I really want is an example of it's use and syntax.
    Thanks in advance.


    --
    wraith_86
    ------------------------------------------------------------------------
    wraith_86's Profile: http://forums.opensuse.org/member.php?userid=20336
    View this thread: http://forums.opensuse.org/showthread.php?t=406129


  2. #2
    ken yap NNTP User

    Default Re: CP Suffix argument Help


    AFAICT the --suffix option just overrides the default ~.

    What you want is actually the --backup=numbered option. See the man
    page. Here's an example:

    > $ touch foo
    > $ cp foo /tmp
    > $ cp --backup=numbered foo /tmp
    > $ ls /tmp/foo*
    > /tmp/foo /tmp/foo.~1~



    --
    ken_yap
    ------------------------------------------------------------------------
    ken_yap's Profile: http://forums.opensuse.org/member.php?userid=221
    View this thread: http://forums.opensuse.org/showthread.php?t=406129


  3. #3
    brunomcl NNTP User

    Default Re: CP Suffix argument Help


    Thats WAAAAAY cool for a quick backup-now/check-later. Thanks!

    shell commands ARE fantastic! Now on to write a GUI

    But, can it do this only if files are different? (man page, I know


    --
    brunomcl
    ------------------------------------------------------------------------
    brunomcl's Profile: http://forums.opensuse.org/member.php?userid=8892
    View this thread: http://forums.opensuse.org/showthread.php?t=406129


  4. #4
    Malcolm NNTP User

    Default Re: CP Suffix argument Help

    Quote Originally Posted by brunomcl
    Thats WAAAAAY cool for a quick backup-now/check-later. Thanks!

    shell commands ARE fantastic! Now on to write a GUI

    But, can it do this only if files are different? (man page, I know
    Hi
    You may want to look at rsync then....

    --
    Cheers Malcolm (Linux Counter #276890)
    openSUSE 11.1 x86 Kernel 2.6.27.7-9-default
    up 10:28, 2 users, load average: 0.00, 0.00, 0.01
    GPU GeForce 6600 TE/6200 TE - Driver Version: 180.22


  5. #5
    wraith 86 NNTP User

    Default Re: CP Suffix argument Help


    I've tried doing exactly what you have listed: cp -R --backup=numbered
    ./test1/ ./test2/ but nothing happens. It just copies the files from one
    directory to another over-writting the files already present.


    --
    wraith_86
    ------------------------------------------------------------------------
    wraith_86's Profile: http://forums.opensuse.org/member.php?userid=20336
    View this thread: http://forums.opensuse.org/showthread.php?t=406129


  6. #6
    ken yap NNTP User

    Default Re: CP Suffix argument Help


    > $ cd /tmp
    > $ mkdir test1 test2
    > $ touch test1/foo test2/foo
    > $ cp -R --backup=numbered test1/* test2/
    > $ ls test2
    > foo foo.~1~
    >


    Looking at your command it looks like you would make a complete copy of
    test1 inside test2, maybe not what you had in mind. Try:


    Code:
    --------------------
    cp -R --backup=numbered test1/. test2/
    --------------------


    --
    ken_yap
    ------------------------------------------------------------------------
    ken_yap's Profile: http://forums.opensuse.org/member.php?userid=221
    View this thread: http://forums.opensuse.org/showthread.php?t=406129


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •