The switch you need is --parents
, e.g.:
jim@prometheus:~$ cp --parents test/1/.moo test2/
jim@prometheus:~$ ls -la test2/
total 42
drwxr-xr-x 3 jim jim 72 2010-09-14 09:32 .
drwxr-xr-x 356 jim jim 43136 2010-09-14 09:32 ..
drwxr-xr-x 3 jim jim 72 2010-09-14 09:32 test
jim@prometheus:~$ ls -la test2/test/1/.moo
-rw-r--r-- 1 jim jim 0 2010-09-14 09:32 test2/test/1/.moo
Related Posts:
- How do I find all files containing specific text on Linux?
- How to change permissions for a folder and its subfolders/files in one step
- Creating a new directory in C
- How to change permissions for a folder and its subfolders/files in one step
- Can’t remove a directory in Unix
- cd into directory without having permission
- Meaning of directories on Unix and Unix like systems
- How do I deal with a filename that starts with the hyphen (-) character?
- Bash: No such file or directory?
- What’s a .sh file?
- How can I symlink a file in Linux? [closed]
- Kill detached screen session [closed]
- How to unmount a busy device
- How to unmount a busy device
- performing HTTP requests with cURL (using PROXY)
- No space left on device
- How to perform grep operation on all files in a directory?
- Amazon Linux: apt-get: command not found
- How can I exclude directories from grep -R?
- gcc: error: unrecognized command line option
- How to set proxy for wget?
- Docker can’t connect to docker daemon
- Need a good hex editor for Linux
- Pseudo-terminal will not be allocated because stdin is not a terminal
- Directory Inode vs Regular File Inode
- How to cat <
> a file containing code? - Diff command along with Grep gives “Binary file (standard input) matches”
- can’t remove python pip
- How would I get a cron job to run every 30 minutes?
- How to automatically redirect HTTP to HTTPS on Apache servers?
- Trying to use bash on Windows and got no installed distributions message
- “Unable to find remote helper for ‘https'” during git clone
- What is the difference between “#!/usr/bin/env bash” and “#!/usr/bin/bash”?
- Is there a “goto” statement in bash?
- tar: Cowardly refusing to create an empty archive
- How can I delete a user in linux when the system says its currently used in a process
- Command to change the default home directory of a user
- Post request with Wget?
- Read and write to binary files in C?
- Telnet [Unable to connect to remote host: Connection refused]
- Terminal Multiplexer for Microsoft Windows – Installers for GNU Screen or tmux
- Is there an alternative sleep function in C to milliseconds?
- Gedit command not working in kali linux terminal
- Syntax error near unexpected token ‘then’
- Curl : connection refused
- How to install Android SDK on Ubuntu?
- C fopen vs open
- How can I use grep to show just filenames on Linux?
- Bash script prints “Command Not Found” on empty lines
- Why does “docker attach” hang?
- Bash export command
- How to edit gitignore file
- Retrieve last 100 lines logs
- What are various options / arguments for “./configure” in Linux
- Adding a new entry to the PATH variable in ZSH
- CronJob not running
- Delete .DS_STORE files in current folder and all subfolders from command line on Mac
- How to configure WP filesystem access in Linux (Ubuntu Server)?
- Can’t upload media to my Raspberry Pi WordPress server
- My WordPress is giving me an 403 error when saving post/draft with specific words
- How do I prevent a folder from reappearing in my home directory?
- How can I sort du -h output by size
- What exactly do the colors in htop status bars mean?
- How to run a server on port 80 as a normal user on Linux?
- Showing total progress in rsync: is it possible?
- How to bind MySQL server to more than one IP address?
- Moving an already-running process to Screen
- What’s the best way of handling permissions for Apache 2’s user www-data in /var/www?
- Permission denied (publickey). SSH from local Ubuntu to Amazon EC2 server
- How to setup passwordless `sudo` on Linux?
- LVM dangers and caveats
- How to know from which yum repository a package has been installed?
- How do I verify the speed of my NIC?
- tar – Remove leading directory components on extraction
- Job scheduling using crontab, what will happen when computer is shutdown during that time?
- How to list Apache enabled modules?
- how do you create an ssh key for another user?
- How can I monitor hard disk load on Linux?
- Why does sudo command take long to execute?
- “POSSIBLE BREAK-IN ATTEMPT!” in /var/log/secure — what does this mean?
- How to display certain lines from a text file in Linux?
- What’s the reverse DNS command line utility?
- Can you have more than one ~/.ssh/config file?
- How to add a security group to a running EC2 Instance?
- How bad is it really to install Linux on one big partition?
- How do I extract login history?
- How to force nginx to resolve DNS (of a dynamic hostname) everytime when doing proxy_pass?
- GPG does not have enough entropy
- SSH from A through B to C, using private key on B [closed]
- Is it possible to reboot a Linux OS without rebooting the hardware?
- Why don’t EC2 ubuntu images have swap?
- SSHFS mount that survives disconnect
- Temporarily ignore my `~/.ssh/known_hosts` file?
- Does the “bs” option in “dd” really improve the speed?
- How to get TX/RX bytes without ifconfig?
- What solutions exist to allow the use of revision control for server configuration files? [closed]
- Curl: disable certificate verification
- Is there a way to do a remote “ls” much like “scp” does a remote copy?
- Dump a linux process’s memory to file
- What is the difference between /sbin/nologin and /bin/false?