Copy files and folders.
Syntax ditto [options] Source_file Destination_file ditto [options] Source Destination_folder ditto -x [options] Source_Archive Destination_folder ditto -c [options] Source Destination_archive Where Source = a file, folder or archive. Options -c create an archive at the destination path. Use a file extension, .zip, .cpio or .cpgz (for Compressed CPIO archives) -v Print a line of output for each source folder copied. -k Instead of CPIO, assume PKZip archives. -V Print a line of output for every file, symbolic link, and device copied. -x the first source is an archive to extract. -X When copying one or more source folders, do not descend into folders that have a different device ID. -z -x implies -z. CPIO archives should be compressed. Uncompressed data flows through the decompressor unmodified. --keepParent The parent directory of src should be embedded in Destination_archive. --keepParent only applies to the creation of archives. --arch arch Copy thin multi-architecture binaries ("fat binaries") to the specified architecture. If multiple -arch options are specified then the resulting destination file will be multi-architectural containing each of the specified architectures (if they are present in the source file). arch should be specified as "ppc", "i386", etc. --bom bom If this option is given then only files, links, devices, and folders that are present in the specified BOM file are copied. --rsrc Preserve resource forks and HFS meta-data. ditto will store this data in Carbon-compatible ._ AppleDouble files on filesystems that do not natively support resource forks. -rsrcFork synonym for --rsrc --sequesterRsrc ditto will preserve resource forks and HFS meta-data in the directory __MACOSX within PKZip archives.
Unlike cp -R, if the destination folder already exists, the existing contents will be merged with the contents of the folder being copied.
Copy the "Documents" folder to "Documents backup".
ditto Documents "Documents backup"
quotes are needed because of the space in the folder name.
To also preserve the Mac resource forks, type and creator codes use:
ditto -rsrcFork Documents "Documents backup"
“The Borgesian meta-library contains a copy of every book ever written, but my dream-artifact is already, and always, every book ever written, on demand” - William Gibson
ditto man page - Apple.com
cp - Copy files
copy - Copy groups of files in folders
dd - Data Dump - convert and copy a file (use for RAW storage)
install - Copy files and set attributes
mv - Move Files
tar - store or extract files to an archive (allows symbolic links to be copied as links)