cp command - Linux

This is a discussion on cp command - Linux ; I have inside folder1 many mp3 songs I wish from folder2 copy many mp3's into folder1 I wish that inside folder1 stay all old mp3s and that be added new mp3s from folder2 if have mp3's with same name: is ...

+ Reply to Thread
Results 1 to 8 of 8

Thread: cp command

  1. cp command


    I have inside folder1 many mp3 songs

    I wish from folder2 copy many mp3's into folder1

    I wish that inside folder1 stay all old mp3s and that be added new
    mp3s from folder2

    if have mp3's with same name: is possible that new mp3 from folder2
    automatically overwrite mp3 in folder1..

    Note: many song names has blank spaces in names, like: "my song
    three.mpg" because that I need strict recursive order " "

    what is best cp command for this..




  2. Re: cp command

    You could have them overwrite the old files if you want.

    Try:

    cp -i folder1/* folder2/

    This will copy all the files from folder1 to folder2, but will ask
    before file are overwritten.


  3. Re: cp command

    >
    > cp -i folder1/* folder2/
    >
    > This will copy all the files from folder1 to folder2, but will ask
    > before file are overwritten.


    RE: have someone idea how do it without overwritten files questions.. I have
    few thousand files and too complicated is push 'yes' many times..



  4. Re: cp command

    On Thu, 17 Mar 2005 00:40:41 +0100, PHP2 wrote:
    >>
    >> cp -i folder1/* folder2/
    >>
    >> This will copy all the files from folder1 to folder2, but will ask
    >> before file are overwritten.

    >
    > RE: have someone idea how do it without overwritten files questions.. I have
    > few thousand files and too complicated is push 'yes' many times..


    have you done a man cp in a terminal.

    You could create a script to get a source filenames, use basename to
    strip source directory, add on target directory, test if file exists,
    copy if not.

    man test
    man find
    man basename

    need brusing up on script language?
    http://www.tldp.org/LDP/abs/html/index.html


  5. Re: cp command


    PHP2 wrote:
    > >
    > > cp -i folder1/* folder2/
    > >
    > > This will copy all the files from folder1 to folder2, but will ask
    > > before file are overwritten.

    >
    > RE: have someone idea how do it without overwritten files questions..

    I have
    > few thousand files and too complicated is push 'yes' many times..


    try --reply=yes

    --
    Scott Bell
    http://www.scottbell.org/


  6. Re: cp command

    * fsuarez2005@yahoo.com wrote in comp.os.linux:
    > You could have them overwrite the old files if you want.


    > Try:


    > cp -i folder1/* folder2/


    > This will copy all the files from folder1 to folder2, but will ask
    > before file are overwritten.


    Could just use

    /bin/cp folder1/* folder2/

    instead of the cp alias and it will overwrite without prompting.

    --
    David
    An efficient and a successful administration manifests itself equally in
    small as in great matters.
    -- W. Churchill

  7. Re: cp command

    Overwhelm with questions you need answered? Become a yes man! Try
    '/bin/yes'. It is guaranteed to keep your job.


  8. Re: cp command

    /bin/cp -f folder1/* folder2/

    From cp man page:
    -f, --force : if an existing destination file cannot be opened, remove
    it and try again

    PHP2 wrote:
    > I have inside folder1 many mp3 songs
    >
    > I wish from folder2 copy many mp3's into folder1
    >
    > I wish that inside folder1 stay all old mp3s and that be added new
    > mp3s from folder2
    >
    > if have mp3's with same name: is possible that new mp3 from folder2
    > automatically overwrite mp3 in folder1..
    >
    > Note: many song names has blank spaces in names, like: "my song
    > three.mpg" because that I need strict recursive order " "
    >
    > what is best cp command for this..
    >
    >
    >


+ Reply to Thread