Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have read about copying files with terminal but these examples will help me a lot. So here is what I want to do:

Examples:

  1. I have a file in /home/levan/kdenlive untitelds.mpg and I want to copy this file to /media/sda3/SkyDrive and do not want to delete any thing in SkyDrive directory.

  2. I have a file in /media/sda3/SkyDrive untitelds.mpg and I want to copy this file to /home/levan/kdenlive and do not want to delete any thing in kdenlive directory

  3. I want to copy a folder from home directory to sda3 and do not want to delete any thing on sda3 directory and opposite

  4. I want to cut a folder/file and copy to other place without deleting files in that directory I cut it into.

share|improve this question

1 Answer 1

up vote 35 down vote accepted

1) This command will ask you if you want to replace the file:

cp -i /home/levan/kdenlive/untitelds.mpg /media/sda3/SkyDrive/

or you can use -b to create a backup of your file:

cp -b /home/levan/kdenlive/untitelds.mpg /media/sda3/SkyDrive



2) Same as the above:

cp (-i or -b) /media/sda3/SkyDrive/untitelds.mpg /home/levan/kdenlive



3) Use -R for recursive and -i for interactive:

cp -Ri ~/MyFolder /sda3/



4) This last one can be done via the mv command, move is like cutting:

mv -i ~/MyFile ~/OtherFolder/MyFile

if you want to move a directory, use:

mv -Ri ~/MyDirectory ~/OtherDirectory/
share|improve this answer
    
Neat syntax highlighting! Not sure how you triggered that. –  Christopher Kyle Horton Oct 3 '12 at 16:05
1  
Thank you so much it works great :) –  Levan Oct 3 '12 at 16:08
2  
@WarriorIng64 That is triggered by the bash tag in the question. highlighting will be enabled by default by the system. If you answer a question with bash tag, the hightlighting will follow bash style and so on. –  Anwar Shah Oct 3 '12 at 16:19
2  
@Anwar I was just partway through making a Meta post on this when I saw your comment. Of course, I credited you in the answer. :) –  Christopher Kyle Horton Oct 3 '12 at 16:24
1  
Thanks!! your answer did a great help –  jparthj Feb 18 at 12:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.