+ Post New Thread
Results 1 to 7 of 7
*nix Thread, copying whole diretory and subs in Technical; Edit following a large bit of dyslexia BTW This is just me trying to find out what the correct command ...
  1. #1

    SimpleSi's Avatar
    Join Date
    Jun 2005
    Location
    Lancashire
    Posts
    5,809
    Thank Post
    1,476
    Thanked 592 Times in 444 Posts
    Rep Power
    168

    copying whole diretory and subs

    Edit following a large bit of dyslexia

    BTW This is just me trying to find out what the correct command is - I can workaround the problem

    I am attempting to copy across the whole of /etc/cups from an eeepc to a pen drive to see if this is a simpel way of cloning printer setup from one to another.

    The pendrive path is long and to save typing it in I was trying to use
    Code:
    cp -r /etc/cups .
    having first navigated to the pendrive folder, but this ends up creating a folder called cups on the pendrive and not a folder called etc with a cups folder within that as I wanted/expected.

    Is there syntax to do what I want?

    regards

    Simon
    Last edited by SimpleSi; 1st May 2009 at 03:47 PM.

  2. #2

    powdarrmonkey's Avatar
    Join Date
    Feb 2008
    Location
    Alcester, Warwickshire
    Posts
    4,859
    Thank Post
    412
    Thanked 777 Times in 650 Posts
    Rep Power
    182
    You want:

    Code:
    cp -r /etc/cups/* <dest>
    (copy recursively the contents of /etc/cups to <dest>)

  3. Thanks to powdarrmonkey from:

    SimpleSi (8th May 2009)

  4. #3

    powdarrmonkey's Avatar
    Join Date
    Feb 2008
    Location
    Alcester, Warwickshire
    Posts
    4,859
    Thank Post
    412
    Thanked 777 Times in 650 Posts
    Rep Power
    182
    Quote Originally Posted by jinnantonnix View Post
    You'll probably have to use 'sudo' before the command; there's protected system stuff in cups.

    Edit: maybe not - eepcs are a lot more open than regular linux machine.
    /etc/cups isn't very sensitive so you can normally read from it. If you were using rm, yes you'd have to be root.

  5. #4

    SimpleSi's Avatar
    Join Date
    Jun 2005
    Location
    Lancashire
    Posts
    5,809
    Thank Post
    1,476
    Thanked 592 Times in 444 Posts
    Rep Power
    168
    Soory about my writing rm instead of cp

    Just for a bit of clarifcation

    I was trying to copy whole of /etc/cups to pen drive folder so I can transfer to anothe eeePC

    pen drive path is very long and full of spaces/capitals e.g

    /media/DataTraveler 2.0/KINGSTON and I've created a folder on there called asusk so full path is

    /media/DataTraveler 2.0/KINGSTON/asusk

    Its very easy to get to this path via file manger when pen drive is pluuged in and then just do a Ctrl-Shift-T to bring up a terminal window and a quick sudo su and I'm nicely in my dest folder.

    Then I'd just like to copy the whole of /etc/cups to my current path

    cp -r /etc/cups/* .

    is the one that does it

    Ta everyone and sorry for mix up

    regards

    Simon

  6. #5

    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    11,803
    Thank Post
    110
    Thanked 583 Times in 504 Posts
    Blog Entries
    1
    Rep Power
    224
    if you want to copy directory's you must 'force' cp to do so.

    Code:
    cp -rf /etc/cups /mnt/PENDRIVE/
    will copy /etc/cups and all it's contents (assuming you have permissions to read the files/folders) to /mnt/PENDRIVE

  7. #6
    petectid's Avatar
    Join Date
    Jun 2005
    Posts
    298
    Thank Post
    2
    Thanked 15 Times in 13 Posts
    Rep Power
    20
    Quote Originally Posted by SimpleSi View Post
    The pendrive path is long and to save typing it in I was trying to use
    Create a shell script with Geoff's command and run that, less typing for you. Geoff may me able to help here not sure but wouldn't the --preserve switch keep all the file permissions?

    Code:
    cp --preserve -rf /etc/cups /mnt/PENDRIVE/
    You may also have to create that mount point.

  8. #7

    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    11,803
    Thank Post
    110
    Thanked 583 Times in 504 Posts
    Blog Entries
    1
    Rep Power
    224
    you can just use '-P' rather than '--preserve'. However if things are getting fiddly, you'd be better tarballing the directory up and moving it around wrapped up like that.

SHARE:
+ Post New Thread

Similar Threads

  1. Pulling copying fails - push copying works
    By SimpleSi in forum Windows
    Replies: 1
    Last Post: 3rd March 2008, 02:29 PM
  2. Cannot cancel copying
    By ranj in forum Mac
    Replies: 5
    Last Post: 11th January 2008, 06:59 PM
  3. File Copying
    By Kwyjibo in forum Scripts
    Replies: 15
    Last Post: 9th May 2007, 03:30 PM
  4. Copying GPOs...How?
    By HodgeHi in forum Windows
    Replies: 4
    Last Post: 24th November 2006, 11:10 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •