LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 05-20-2015, 02:24 PM   #1
harunaadoga
LQ Newbie
 
Registered: Sep 2014
Location: Hatfield, United Kingdom
Distribution: Centos
Posts: 24

Rep: Reputation: Disabled
cp from mounted usb drive


I mounted a usb pen drive on /dev/sdb1 /media/mydrive. now trying to copy files from the mount and it wont just work.
On /media I used cp mydrive ~/Documents/.
help pls
 
Old 05-20-2015, 02:46 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,364

Rep: Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004
We don't read minds. What do you mean it "just won't work"? What does it do? Are there any error messages?
 
Old 05-20-2015, 02:52 PM   #3
harunaadoga
LQ Newbie
 
Registered: Sep 2014
Location: Hatfield, United Kingdom
Distribution: Centos
Posts: 24

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by suicidaleggroll View Post
We don't read minds. What do you mean it "just won't work"? What does it do? Are there any error messages?
It gives the line as shown below.

cp: omitting directory ‘mydrive/’
 
Old 05-20-2015, 03:02 PM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,364

Rep: Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004
You're trying to copy an entire directory, which means you need to use the recursive (-r) flag in cp

Code:
cp -r mydrive ~/Documents/
This will copy the directory mydrive into ~/Documents, so your files will be in ~/Documents/mydrive/
 
1 members found this post helpful.
Old 05-20-2015, 03:03 PM   #5
harunaadoga
LQ Newbie
 
Registered: Sep 2014
Location: Hatfield, United Kingdom
Distribution: Centos
Posts: 24

Original Poster
Rep: Reputation: Disabled
thanks.
 
Old 05-20-2015, 08:39 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,061

Rep: Reputation: 1916Reputation: 1916Reputation: 1916Reputation: 1916Reputation: 1916Reputation: 1916Reputation: 1916Reputation: 1916Reputation: 1916Reputation: 1916Reputation: 1916
See the "Did you find this post helpful" ?.
Click "yes" in post #4 (to enhance the rep of helpful responders).
 
Old 05-21-2015, 06:03 AM   #7
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
A more better command is:

Code:
cp -dpr mydrive ~/Documents/
'-p' preserves permissions and '-d' copy symlinks not what it points to.
 
Old 05-21-2015, 06:07 AM   #8
fatmac
Senior Member
 
Registered: Sep 2011
Location: Surrey/Hants Border, UK
Distribution: BSD & Linux - As long as they are Lightweight
Posts: 1,704

Rep: Reputation: Disabled
...or cp -a
 
  


Reply

Tags
mount usb, usb drive


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
[SOLVED] USB flash drive not mounted ilesterg Linux - Hardware 3 05-15-2013 06:09 PM
Keep USB hard drive from spinning down while mounted nonoitall Linux - General 4 04-12-2010 03:53 AM
Is there ANY way for a proper shut down if USB has crashed with a mounted USB drive? TTL_2 Linux - Hardware 2 09-24-2008 09:04 AM
How is an USB drive mounted, and how can I change the permissions jjge Ubuntu 6 04-26-2007 06:59 PM
Can not access mounted USB drive Honkeychops Mandriva 5 03-06-2006 01:59 PM


All times are GMT -5. The time now is 04:32 AM.

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