LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 04-08-2023, 03:38 PM   #1
J Harp
Member
 
Registered: Sep 2009
Posts: 133

Rep: Reputation: 0
Command line help copying directory


Trying to copy my documents directory from an external hard drive to another computer.
I've been trying sudo cp -a/Media/Toshiba/Documents/ /Home/jim/Documents.
What am I doing wrong, I always get an error, cp: invalid option -- '/'

I admit I don't understand command line usage and the help suggestions are Greek to me. The computer is a Dell Optiplex 7010.
 
Old 04-08-2023, 03:44 PM   #2
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,147
Blog Entries: 6

Rep: Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834
Code:
cp /Media/Toshiba/Documents/* /Home/jim/Documents/
Everthing in /Media/Toshiba/Documents/* into /Home/jim/Documents/

Also loo at cp -nR
 
1 members found this post helpful.
Old 04-08-2023, 05:50 PM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,730

Rep: Reputation: 7973Reputation: 7973Reputation: 7973Reputation: 7973Reputation: 7973Reputation: 7973Reputation: 7973Reputation: 7973Reputation: 7973Reputation: 7973Reputation: 7973
Quote:
Originally Posted by J Harp View Post
Trying to copy my documents directory from an external hard drive to another computer. I've been trying
Code:
sudo cp -a/Media/Toshiba/Documents/ /Home/jim/Documents.
What am I doing wrong, I always get an error, cp: invalid option -- '/'
I admit I don't understand command line usage and the help suggestions are Greek to me. The computer is a Dell Optiplex 7010.
You don't tell us what version/distro of Linux, but did you look at the command line you posted?? There needs to be a space after the "-a", and no period after the "Documents", if that's the exact command line you typed in. Also, /home is rarely capitalized. And do you have any files that start with a dash??

After fourteen years of Linux usage, you should be well aware that Linux is case sensitive. And if you find the CLI to be 'Greek', then why don't you use any file manager of your choice and drag/drop them to where you want???
 
1 members found this post helpful.
Old 04-09-2023, 07:37 PM   #4
J Harp
Member
 
Registered: Sep 2009
Posts: 133

Original Poster
Rep: Reputation: 0
Thank you teckk

I copy-pasted your suggestion, it returned an error.
cp: cannot stat '/Media/Toshiba/Documents/*': No such file or directory
Command 'cp:' not found, did you mean:
command 'cpr' from deb node-cpr (3.0.1-4)
command 'cpp' from deb cpp (4:11.2.0-1ubuntu1)
command 'cpm' from deb cpm (0.32-1.3)
command 'cp' from deb coreutils (8.32-4.1ubuntu1)
command 'cpu' from deb cpu (1.4.3-13build1)
command 'cph' from deb conda-package-handling (1.7.3-2build1)
Try: sudo apt install <deb name>

TBOne

Thank you for suggesting I use file manager, that's what I had been seeking, but everything I could find by searching was to use the command line.
I got the documents copied by using nemo. I seldom need to do more file moving than putting onto a USB stick or copying from one, so don't get much practice. The OS is Linux Mint 21.1 Vera Cinnamon. No I didn't intend to end the command with a period, it's force of habit to end a sentence that way, and I overlooked it. I'll mark this as solved.
 
Old 04-09-2023, 08:01 PM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,773

Rep: Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933
Quote:
cp: cannot stat '/Media/Toshiba/Documents/*': No such file or directory
External drives are typically mounted at /media/... It isn't evident if what you posted in #1 are typos or the actual command used. linux is case sensitive.
 
Old 04-10-2023, 04:01 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,013

Rep: Reputation: 7340Reputation: 7340Reputation: 7340Reputation: 7340Reputation: 7340Reputation: 7340Reputation: 7340Reputation: 7340Reputation: 7340Reputation: 7340Reputation: 7340
one problem is that you need to add a space after -a:
Code:
cp -a /Media/.....whatever
     ^
In your original post I can't see that space. Otherwise if you are not familiar with the command line use some kind of GUI. But without details hard to say more.
 
  


Reply



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
Copying home folder from command line without copying hidden directories and files rm_-rf_windows Linux - General 2 04-12-2016 08:24 AM
drag-drop copying and cp command both hang at last few KB when copying to flash drive slacker_ Linux - Newbie 1 09-05-2013 07:17 AM
Print all PID folders from /proc line-by-line with this format (( PID: command-line )) courteous Linux - Newbie 7 12-12-2010 04:47 PM
awk command line: blank line record sep, new line field sep robertmarkbram Programming 4 02-21-2010 05:25 AM
grab the line below a blank line and the line above the next blank line awk or perl? Pantomime Linux - General 7 06-26-2008 08:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 08:44 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