LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 01: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, 01:46 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
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, 01: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, 02:02 PM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
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, 02: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, 07:39 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
See the "Did you find this post helpful" ?.
Click "yes" in post #4 (to enhance the rep of helpful responders).
 
Old 05-21-2015, 05: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, 05:07 AM   #8
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,487

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


Reply

Tags
mount usb, usb drive



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 05:09 PM
Keep USB hard drive from spinning down while mounted nonoitall Linux - General 4 04-12-2010 02: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 08:04 AM
How is an USB drive mounted, and how can I change the permissions jjge Ubuntu 6 04-26-2007 05:59 PM
Can not access mounted USB drive Honkeychops Mandriva 5 03-06-2006 12:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:58 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
Open Source Consulting | Domain Registration