Rsync using old date

Using rsync to backup my docker containers:
rsync -avzP --exclude /home/john/docker/frigate/storage /home/john/docker /home/backup

but the backed up files are using the date of an old directory, in the backup directory…

drwxrwxrwx 5 root root 4096 Jul 28 21:46 .
drwxr-xr-x 7 root root 4096 Jul 20 19:17 ..
drwxrwxr-x 9 john john 4096 Jul 20 20:36 docker
drwxrwxr-x 9 john john 4096 Jul 20 20:36 docker20260720
drwxrwxr-x 9 john john 4096 Jul 20 20:36 docker20260728
-rw------- 1 john john  634 Jul 28 21:34 dockerBackup.txt

ie the original directory is “docker20260720” which is the correct date, but the 2 other directories were copied today (20260728), but have the OLD backups date…??

What have I done wrong?

Please always include the line with the prompt and the command, it is only one line more to copy/paste at the beginning. Now we have to guess if your utterance “in the backup directory” is correct and what it means. Also we can not see the contents of the original directory. How can we compare?

Also for me there is some confusion about the (modification) date of the files and date indications incorporated in file names.

john@media:/home/backup$ ll
total 24
drwxrwxrwx 5 root root 4096 Jul 28 21:46 ./
drwxr-xr-x 7 root root 4096 Jul 20 19:17 ../
drwxrwxr-x 9 john john 4096 Jul 20 20:36 docker/
drwxrwxr-x 9 john john 4096 Jul 20 20:36 docker20260720/
drwxrwxr-x 9 john john 4096 Jul 20 20:36 docker20260728/
-rw------- 1 john john  634 Jul 28 21:34 dockerBackup.txt
john@media:/home/backup$

I believe my issue is I don’t understand rsync options, completely…
Using
rsync -avP /home/john/docker /home/backup
and now understand (I think), that the -a also preserves the creation date of the original ‘top’ directory, hence all backups will have the time/date for the original directory…
Thanks.

I was looking into this, and your finding is correct. .

Your rsync command should be literally placing All subdirectories and files inside /home/john/docker into a folder called /home/backup
Because you are not using your Terminating / on /home/john/docker (/home/john/docker/)
the result output should be :
Everything inside /home/john/docker/* will go into → /home/back/home/john/docker/
That is rsync will place everything inside /home/john/docker/* into your /home backup directory.
It will be in /home/backup/home/john/docker
That should be the standard behavior of rsync on your prompt.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.