Andrew Fletcher published: 18 December 2019 (updated) 20 December 2019 1 minute read
To copy the content of a directory /source to another existing directory /destination can be achieved with the command cp -a
cp -a source/. destination/
Changing the variables accordingly:
- source = challenge/vendor/
- destination = stg/vendor/
cp -a challenge/vendor/. stg/vendor/
- The -a option is an improved recursive option, that preserve all file attributes and also preserves symlinks;
- The full point (.) at end of the source path (i.e. challenge/vendor/.) is a specific cp syntax that allows you to copy all files and directories (included hidden ones).
Related articles
Andrew Fletcher
•
16 Jan 2025
get IP address from terminal OSX
When troubleshooting network issues or configuring devices, knowing your IP address can be essential. Whether you're connected via Wi-Fi, Ethernet, or tethering through a mobile provider, macOS offers powerful built-in tools to quickly identify your IP address. Here's a practical guide tailored to...
Andrew Fletcher
•
07 Jan 2025
Managing DDEV environment troubleshooting and setting up multiple Drupal projects
DDEV has become a popular tool for local web development, offering a streamlined approach to managing Docker-based environments. However, setting up and managing DDEV projects, particularly with the latest versions of Docker Desktop, can present challenges. This article guides you through resolving...
Andrew Fletcher
•
28 Dec 2024
Optimising file transfers by improving efficiency from cp to rsync
Transferring files between development and production environments is a critical task in the deployment process. However, I continue to come across multiple approaches that scale from awesome automation using pipelines to the basic of direct command line entry. Where the basic approaches rely on...