LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Ubuntu server16.04 copy folder from mounted usb to home folder (https://www.linuxquestions.org/questions/linux-newbie-8/ubuntu-server16-04-copy-folder-from-mounted-usb-to-home-folder-4175607030/)

fillister 05-31-2017 08:39 AM

Ubuntu server16.04 copy folder from mounted usb to home folder
 
Hello all,

I have ssh into my ubuntu server and mounted a usb drive, what I would like to do is copy the folder nzedb to my home directory on this server. my attempts so far have resulted in an error message cannot stat no such directory.

sudo cp /dev/sdb1/nzedb ~/
[sudo] password for greg:
cp: cannot stat '/dev/sdb1/nzedb': Not a directory

Any help will be greatly appreciated

Thank you

r3sistance 05-31-2017 08:45 AM

you need to mount the device first, you can't pull it directly from the raw block device.

So say...

Code:

mkdir /mnt/usb
mount /dev/sdb1 /mnt/usb
cp /mnt/usb/nzedb ~/

once done remember to unmount it and clean up.

Code:

umount /mnt/usb
rmdir /mnt/usb


dejank 05-31-2017 09:14 AM

https://unix.stackexchange.com/quest...ctory-y#115564

fillister 05-31-2017 09:24 AM

Thank you r3sistance

I had to use the -r command then it worked perfect, I've been beating my head on the floor for a while on this and you have been a great help.

sudo cp /mnt/usb/nzedb ~/
cp: omitting directory '/mnt/usb/nzedb'
greg@nzedb:~$ sudo cp -r /mnt/usb/nzedb ~/
greg@nzedb:~$ ls
nzedb


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