I am using the command below, in my target sever:
rsync -ab myuser@sourcehost:/source_dir/* target_dir But this is not able to sync the hidden files present source_dir anything I need to use any --include so that the hidden files can be migrated.
But that include option should not affect the migration of normal files as I'm using this command in my script.
What should I do?
01 Answer
The problem is not rsync, but the shell.
Normally in Ubuntu, dotglob is disabled, meaning that files starting with . are excluded from * expansion.
You can turn this on running.
shopt -s dotglob Then your command should work (I think you're just missing -e ssh)
It's sensible to unset dotglob after use with:
shopt -u dotglob Alternatively, you can simply tell rsync to copy the folder contents to target_dir, which includes hidden files:
rsync --ab -e ssh myuser@sourcehost:/source_dir/ target_dir