Author Topic: Copying Folder with CLI. [SOLVED]  (Read 2655 times)

Offline AndyInMokum

  • Global Moderator
  • Hero
  • *****
  • Posts: 4889
  • Karma: 1058
  • "Keep on Rockin' in the Free World"
    • View Profile
  • Peppermint version(s): PM 9 & PM 10 (64-bit)
Copying Folder with CLI. [SOLVED]
« on: June 18, 2014, 01:55:09 pm »
Good evening everyone.  How's it going?  I'm having a problem copying folders from one location to another in the CLI.  I keep getting, "syntax error near unexpected token `('".  I'm  trying to copy a film from a ITB HDD to a 32GB USB stick with 10.1GB of free space. The output of /media/andy/Intenso-1TB/Videos/Films $ is provided below:
Spoiler (click here to view / hide)
[close]
The command and output:
Spoiler (click here to view / hide)
[close]
PNY-32GB is the target USB drive.  I tried it with different folders and I get the same result.  I'm don't know what I'm missing.  A push in the right direction would be most helpful - many thanks.
« Last Edit: June 18, 2014, 02:52:49 pm by AndyInMokum »
Backup! Backup! Backup! If you're missing any of these -  you ain't Backed Up!
For my system info please L/click HERE.

Offline emegra

  • Administrator
  • Veteran
  • *****
  • Posts: 1946
  • Karma: 450
  • New Forum User
    • View Profile
  • Peppermint version(s): Peppermint 10 64bit
Re: Copying Folder with CLI.
« Reply #1 on: June 18, 2014, 02:08:41 pm »
Hi Andy

Just guessing here but could the problem be the white spaces within  "The Shawshank Redemption (1994)"




Graeme
If you can keep your head while all around are losing theirs then you're not quite grasping the situation

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26452
  • Karma: 65531
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Re: Copying Folder with CLI.
« Reply #2 on: June 18, 2014, 02:25:39 pm »
That's exactly the problem .. file/folder names with spaces need to be surrounded with quotation marks .. .so the command  line interpreter realises the space isn't the end of the command.

So...
Code: [Select]
cp -r /media/andy/Intenso-1TB/Videos/Films/"The Shawshank Redemption (1994)" /media/andy/PNY-32GB/Videos/Films/
Another way of doing it would be
Code: [Select]
cp -r "/media/andy/Intenso-1TB/Videos/Films/The Shawshank Redemption (1994)" /media/andy/PNY-32GB/Videos/Films/
quotation marks are ignored by bash, but everything between them is seen as a single string

and you can use either single quotation marks, as in -  'text here' or double quotation marks - "text here"

did that make sense ?
« Last Edit: June 18, 2014, 02:50:34 pm by PCNetSpec »
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline AndyInMokum

  • Global Moderator
  • Hero
  • *****
  • Posts: 4889
  • Karma: 1058
  • "Keep on Rockin' in the Free World"
    • View Profile
  • Peppermint version(s): PM 9 & PM 10 (64-bit)
Re: Copying Folder with CLI.
« Reply #3 on: June 18, 2014, 02:52:17 pm »
That's exactly the problem .. file/folder names with spaces need to be surrounded with quotation marks .. .so the command  line interpreter realises the space isn't the end of the command.

So...
Code: [Select]
cp -r /media/andy/Intenso-1TB/Videos/Films/"The Shawshank Redemption (1994)" /media/andy/PNY-32GB/Videos/Films/
Another way of doing it would be
Code: [Select]
cp -r "/media/andy/Intenso-1TB/Videos/Films/The Shawshank Redemption (1994)" /media/andy/PNY-32GB/Videos/Films/
quotation marks are ignored by bash, but everything between them is seen as a single string

did that make sense ?
Hi Andy

Just guessing here but could the problem be the white spaces within  "The Shawshank Redemption (1994)"




Graeme
I thought exactly the same.  So I got shot of all the white spaces in the original folder I was trying to move.  That made no difference  :(.   

Hi Mark, not only did it make sense - it works too  ;), as if it wouldn't eh!  I don't understand why renaming the folders without the white spaces and then trying to copy them didn't work though  :-\.   On that note,  I'll call this a wrap, many thanks guys.
Backup! Backup! Backup! If you're missing any of these -  you ain't Backed Up!
For my system info please L/click HERE.

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26452
  • Karma: 65531
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Re: Copying Folder with CLI. [SOLVED]
« Reply #4 on: June 18, 2014, 03:01:01 pm »
No problem :)
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline rjm65

  • Veteran
  • ****
  • Posts: 1035
  • Karma: 313
  • I have Peppermint Fresh Breath. :P
    • View Profile
  • Peppermint version(s): Win-98 /Win-7/ Peppermint 9
Re: Copying Folder with CLI.
« Reply #5 on: June 18, 2014, 03:07:53 pm »

quotation marks are ignored by bash, but everything between them is seen as a single string

and you can use either single quotation marks, as in -  'text here' or double quotation marks - "text here"

did that make sense ?
That reminds me of Java scripts way too much...   LOL  ;)
Robert
Peppermint 9 User

Gateway Solo 9300 Pro
IBM T40