Copying all files - including hidden ones


Results 1 to 4 of 4

Thread: Copying all files - including hidden ones

Hybrid View

  1. #1
    Join Date
    Aug 2002
    Location
    Essex, UK
    Posts
    937

    Copying all files - including hidden ones

    Probably showing my ignorance here, but how exactly do you copy all the files in a directory, including all the ones that begin with a dot such as .bashrc?
    cp .* gives errors, because it copies again and again, as .* includes ../directory/.file as well as .file. cp * doesn't copy hidden files.
    Hopefully someone can enlighten me with the answer to a problem I really should've asked before
    Registered Linux User #325947

    Check out Feather Linux, my distro.
    (Yes, it's shameless self promotion, deal with it )

  2. #2
    Join Date
    Jun 2003
    Posts
    5
    I should think:

    cp `ls -A` destination

    will do it.

    "ls -A" lists nearly all the files in the current directory, it includes dot files, but not "." or ".." . It's enclosed in backticks (above the tab key). That makes bash replace it with the output of the command.

  3. #3
    Join Date
    Jun 2002
    Location
    Parump, NV
    Posts
    859
    cp -Rav /path/

  4. #4
    Join Date
    Aug 2004
    Location
    Ohio
    Posts
    9
    could be wrong but I would try
    cp -R /directory/to/be/copied /new/directory
    Slack-Current
    700 MHz Pentium 3
    128 MB RAM

    favorite fortune for now:
    All things are possible,
    except for skiing through
    a revolving door

Posting Permissions

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