Are you trying to use the rsync tool to copy only the hidden files and directory in Linux?
This article is for you.
The rsync command synchronizes files from a source to a destination, on a local machine or over a secure network connection. It is a fast, flexible, secure replacement for the command rcp.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform Linux related tasks.
In this context, we shall look into how to use rsync command in Linux.
How to use rsync command to synchronize all hidden files?
Lets say we want to use the pattern .[^.]* or .??* to select and display only hidden files using ls command.
You can use the same pattern with any Unix command including rsync command.
The syntax is as follows to copy hidden files with rsync:
rsync -av /path/to/dir/.??* /path/to/destination
More information about Rsync Copy Hidden Dot File Command Options?
The options are as follows:
-a – Archive mode copy. In this mode all given files are copied in recursive mode. Copy symlinks as symlinks, file permissions, date and time stamps, and much more.
-v – Verbose copy. In other words, show what the rsync is doing.
-z – Compress file data during the transfer.
-P – Display progress bar