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?
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.
Then your command should work (I think you're just missing
-e ssh
)It's sensible to unset
dotglob
after use with:Alternatively, you can simply tell
rsync
to copy the folder contents totarget_dir
, which includes hidden files: