How can I copy a hidden directory recursively and preserving its permissions?

munish
mkdir backupcache    
cp -rp .cache backupcache # or cp -rp \.cache backupcache does not work

nothing gets copied and directory backupcache remains empty

Rahul

Don't specify the files or Directory

Lets say you created the new folder (or are going to create one) and want to copy the files to it after the folder is created

mkdir /test/folder
cp -rp /path/to/copy/. /test/folder

This will copy all files/folder recursively from /path/from/copy in to the already existing folder created on the first line.

Another approach is tar. For example:

$cd foo
$tar cf - . | tar -C /path/to/bar -x

Using rsync :

rsync -av src dest

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I recursively copy files by file extension, preserving directory structure?

From Dev

How can I recursively copy files without overwriting existing permissions?

From Dev

How can I recursively copy files without overwriting existing permissions?

From Dev

How to recursively copy files as hard links into directory preserving directory hierarchy?

From Dev

copy recursively except hidden directory

From Dev

How can I move files by type recursively from a directory and its sub-directories to another directory?

From Dev

How can I move files by type recursively from a directory and its sub-directories to another directory?

From Dev

How can I recursively copy all pdf files in a directory (and it's subdirectories) into a single output directory?

From Dev

find modified files recursively and copy with directory preserving directory structure

From Dev

How can I recursively list Md5sum of all the files in a directory and its subdirectories?

From Dev

How can I run a script recursively in a directory

From Dev

Recursively copy a directory entirely as symlinks, preserving current symlinks

From Dev

Copy recursively a directory excluding a subdirectory and ITS CONTENT

From Dev

How can I recursively find a directory by name and delete its contents (including all sub-directories and files) while keeping the directory itself?

From Dev

How can I recursively find a directory by name and delete its contents (including all sub-directories and files) while keeping the directory itself?

From Dev

How do I recursively copy/download a whole webdav directory?

From Dev

How do I copy all files recursively to a flat directory in Ruby?

From Dev

How do I recursively copy/download a whole webdav directory?

From Dev

How can I see the permissions of a specific directory?

From Dev

How can I recursively change the permissions of files and directories?

From Dev

How can I recursively change the permissions of files and directories?

From Dev

How can I recursively set read-only permissions?

From Dev

How can I recursively change the permissions of specific files into a list of directories?

From Dev

How can I recursively clear the "Hidden" file flag on Windows Vista?

From Dev

How do I copy/move files WITHOUT retaining/preserving the security/sharing permissions?

From Dev

How can I copy a directory, overwriting its contents if it exists using Powershell?

From Dev

Ansible: How to recursively set directory and file permissions

From Dev

How can I recursively copy files by file extension?

From Dev

cp directory with permissions but not recursively

Related Related

  1. 1

    How can I recursively copy files by file extension, preserving directory structure?

  2. 2

    How can I recursively copy files without overwriting existing permissions?

  3. 3

    How can I recursively copy files without overwriting existing permissions?

  4. 4

    How to recursively copy files as hard links into directory preserving directory hierarchy?

  5. 5

    copy recursively except hidden directory

  6. 6

    How can I move files by type recursively from a directory and its sub-directories to another directory?

  7. 7

    How can I move files by type recursively from a directory and its sub-directories to another directory?

  8. 8

    How can I recursively copy all pdf files in a directory (and it's subdirectories) into a single output directory?

  9. 9

    find modified files recursively and copy with directory preserving directory structure

  10. 10

    How can I recursively list Md5sum of all the files in a directory and its subdirectories?

  11. 11

    How can I run a script recursively in a directory

  12. 12

    Recursively copy a directory entirely as symlinks, preserving current symlinks

  13. 13

    Copy recursively a directory excluding a subdirectory and ITS CONTENT

  14. 14

    How can I recursively find a directory by name and delete its contents (including all sub-directories and files) while keeping the directory itself?

  15. 15

    How can I recursively find a directory by name and delete its contents (including all sub-directories and files) while keeping the directory itself?

  16. 16

    How do I recursively copy/download a whole webdav directory?

  17. 17

    How do I copy all files recursively to a flat directory in Ruby?

  18. 18

    How do I recursively copy/download a whole webdav directory?

  19. 19

    How can I see the permissions of a specific directory?

  20. 20

    How can I recursively change the permissions of files and directories?

  21. 21

    How can I recursively change the permissions of files and directories?

  22. 22

    How can I recursively set read-only permissions?

  23. 23

    How can I recursively change the permissions of specific files into a list of directories?

  24. 24

    How can I recursively clear the "Hidden" file flag on Windows Vista?

  25. 25

    How do I copy/move files WITHOUT retaining/preserving the security/sharing permissions?

  26. 26

    How can I copy a directory, overwriting its contents if it exists using Powershell?

  27. 27

    Ansible: How to recursively set directory and file permissions

  28. 28

    How can I recursively copy files by file extension?

  29. 29

    cp directory with permissions but not recursively

HotTag

Archive