LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-03-2014, 07:41 PM   #1
Cocolate
Member
 
Registered: Jul 2013
Location: I live in an igloo
Distribution: Hoping to fix my Internets! xD
Posts: 107

Rep: Reputation: Disabled
Transfer files and omit duplicates?


Is the command to copy files over from my USB to my Music folder without copying duplicates of the same files:

Code:
cp -u /home/<user>/<device> /media/<user>/Music
I am copying music FROM usb TO music folder.

?

...

UPDATE: no that is not the command because here is my error:

Code:
cp: cannot stat ‘/home/cocolate/PENDRIVE’: No such file or directory
...

Did not work

Code:
cp -u /media/cocolate/PENDRIVE /home/cocolate/Music
Error

Code:
cp: omitting directory ‘/media/cocolate/PENDRIVE’

Last edited by Cocolate; 09-03-2014 at 08:02 PM.
 
Old 09-03-2014, 07:44 PM   #2
solarisguy
Member
 
Registered: Aug 2010
Location: Seattle
Distribution: CentOS, RHEL, Oracle Enterprise Linux, Solaris, BSD
Posts: 64

Rep: Reputation: 17
Try the following:

Code:
cp -uvn /home/<user>/<device> /media/<user>/Music
 
Old 09-03-2014, 07:56 PM   #3
Cocolate
Member
 
Registered: Jul 2013
Location: I live in an igloo
Distribution: Hoping to fix my Internets! xD
Posts: 107

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by solarisguy View Post
Try the following:

cp -uvn /home/<user>/<device> /media/<user>/Music
Really appreciate the quick reply solarisguy. This is my error:

Code:
cp: cannot stat ‘/home/cocolate/PENDRIVE’: No such file or directory
PENDRIVE is located at /media/cocolate

Im getting error for every way I tried that */PENDRIVE is no such file or directory.

PENDRIVE is the name of my <device>

(Name of <device> is 100% for sure PENDRIVE)

Last edited by Cocolate; 09-03-2014 at 08:04 PM.
 
Old 09-03-2014, 08:12 PM   #4
Cocolate
Member
 
Registered: Jul 2013
Location: I live in an igloo
Distribution: Hoping to fix my Internets! xD
Posts: 107

Original Poster
Rep: Reputation: Disabled
I ran the command as sudo and I got this error

cp: omitting directory ‘/media/cocolate/PENDRIVE’

This is the command I used

Code:
sudo cp -uvn /media/cocolate/PENDRIVE /home/cocolate/Music
What is my error?
 
Old 09-03-2014, 08:15 PM   #5
Cocolate
Member
 
Registered: Jul 2013
Location: I live in an igloo
Distribution: Hoping to fix my Internets! xD
Posts: 107

Original Poster
Rep: Reputation: Disabled
I added -r

now I am seeing lots and lots of text scroll down amidst various titles of my music..
 
Old 09-03-2014, 08:19 PM   #6
Cocolate
Member
 
Registered: Jul 2013
Location: I live in an igloo
Distribution: Hoping to fix my Internets! xD
Posts: 107

Original Poster
Rep: Reputation: Disabled
Heres a sample of the string scrolling down. I had a folder inside the USB. I have read that is why I could not copy, but it looks like it isnt copying to my music folder?

Code:
‘/media/cocolate/PENDRIVE/Downloads/Beats by sally bobo - smile.mp3’ -> ‘/home/cocolate/Music/PENDRIVE/Downloads/Beats by sally bobo - smile.mp3’

Its not copying to music is it? Its copying back to the folder its from originally, no?

Code:
-> '/home/cocolate/Music/PENDRIVE/Downloads/*
?

I ran this command

Code:
sudo cp -uvnr /media/cocolate/PENDRIVE /home/cocolate/Music
Please Help!

Last edited by Cocolate; 09-03-2014 at 08:25 PM.
 
Old 09-03-2014, 08:29 PM   #7
Cocolate
Member
 
Registered: Jul 2013
Location: I live in an igloo
Distribution: Hoping to fix my Internets! xD
Posts: 107

Original Poster
Rep: Reputation: Disabled
Ya that was not it was not copying anything. PLEEEASE HEEEELP
 
Old 09-03-2014, 08:30 PM   #8
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 5,387

Rep: Reputation: 397Reputation: 397Reputation: 397Reputation: 397
Code:
cp -uvn /media/cocolate/PENDRIVE/*.mp3 /home/cocolate/Music
Or replace *.mp3 by * if there are other file format you want to copy
(no need to sudo if you have access to /media/cocolate/PENDRIVE as normal user)
 
1 members found this post helpful.
Old 09-03-2014, 08:39 PM   #9
solarisguy
Member
 
Registered: Aug 2010
Location: Seattle
Distribution: CentOS, RHEL, Oracle Enterprise Linux, Solaris, BSD
Posts: 64

Rep: Reputation: 17
Let's try this using rsync:

Code:
rsync -rv --progress --ignore-existing /media/cocolate/PENDRIVE/*.mp3 /home/cocolate/Music
 
1 members found this post helpful.
Old 09-03-2014, 08:44 PM   #10
Cocolate
Member
 
Registered: Jul 2013
Location: I live in an igloo
Distribution: Hoping to fix my Internets! xD
Posts: 107

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by solarisguy View Post
Let's try this using rsync:

Code:
rsync -rv --progress --ignore-existing /media/cocolate/PENDRIVE/*.mp3 /home/cocolate/Music
Thanks, thats looking more like it. Please excuse that I had reposted this thread if you see it again.

Does it make a difference that I have folders within the folder within a folder copying from the PENDRIVE?

Here is a string that is copying:

Code:
Spirit - Moving Target (Juju RMX).mp3
     8128128 100%    6.90MB/s    0:00:01 (xfer#130, to-check=222/555)
Thats looking pretty good to me but I dont see FROM where TO where the files are they being copied?

ALSO SOME OF MY MUSIC ARE IN WAV FILES.......?

Last edited by Cocolate; 09-03-2014 at 08:46 PM.
 
Old 09-03-2014, 08:50 PM   #11
Cocolate
Member
 
Registered: Jul 2013
Location: I live in an igloo
Distribution: Hoping to fix my Internets! xD
Posts: 107

Original Poster
Rep: Reputation: Disabled
OK what that did was copy everything from the PENDRIVE folder to the Music folder but it did not copy any of the folders within the folder of the PENDRIVE (I have 3 folders within folders). So I updated the command to include the name of those folders in the path.

Nothing copied twice. That was success and the files saved to music. Thanks Thanks Thanks!

What about WAV files most likely I will just do it again and replace *.mp3 > *.WAV

Awesome

Last edited by Cocolate; 09-03-2014 at 08:51 PM.
 
Old 09-03-2014, 10:23 PM   #12
solarisguy
Member
 
Registered: Aug 2010
Location: Seattle
Distribution: CentOS, RHEL, Oracle Enterprise Linux, Solaris, BSD
Posts: 64

Rep: Reputation: 17
That should work for wav files as well. Be mindful that case does matter if your filesystem is case sensitive.

Your USB drive is likely FAT32, whereas your Linux system is more likely ext3 or ext4. FAT32 is not case sensitive where all ext filesystems are case sensitive.
 
1 members found this post helpful.
Old 09-04-2014, 05:19 AM   #13
Cocolate
Member
 
Registered: Jul 2013
Location: I live in an igloo
Distribution: Hoping to fix my Internets! xD
Posts: 107

Original Poster
Rep: Reputation: Disabled
Yes thank you so much you made my day much easier and solved my problem. Truly appreciate everything.
 
Old 09-04-2014, 06:14 AM   #14
solarisguy
Member
 
Registered: Aug 2010
Location: Seattle
Distribution: CentOS, RHEL, Oracle Enterprise Linux, Solaris, BSD
Posts: 64

Rep: Reputation: 17
Glad it worked. rsync is your friend, for local and network transfers. Remember to use the -z flag for network transfers to compress and save bandwidth, at the expense of a bit of CPU time.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Chemistry problem: Identify duplicates and non-duplicates within TWO sdf files robertselwyne Programming 5 12-09-2011 07:20 AM
[SOLVED] Duplicates or hard-linked files? littlebigman Linux - Software 7 07-18-2011 10:14 AM
Merging files and removing near-duplicates TheBigH Linux - Newbie 3 12-02-2009 05:24 PM
BASH out duplicates from multiple text files smudge|lala Linux - General 3 09-24-2008 08:51 PM
Comparing 2 Files for Duplicates Mr_H Linux - Newbie 5 11-09-2005 01:43 PM


All times are GMT -5. The time now is 01:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration