Perhaps there is a better way, however, I have tried using cpio but the problem come in when I copy to the NAS drive (NTFS) I lose all my owner/group and permissions. I have found that if I tar the files, then copy them to the NAS, when I untar on the server, it will retain the owner/group and permissions.
So… here is what I have tried:
First, I use the find command to see what files should be in the tar archive.
Code:
/export $ find . -depth -mtime 0 -print ./file4 ./file3 .
Ok, that looks right, now I will try to pipe that in to tar
Code:
/export $ find . -depth -mtime 0 -print0 | tar -czvf backup.tar.gz --null -T - ./file4 ./file3 ./ ./share/ ./share/pdf/ ./share/pdf/penny-2014-09-03-11:41.30.pdf ./share/pdf/penny-2014-09-03-14:25.17.pdf ./share/pdf/penny-2014-09-03-11:24.36.pdf ./share/pdf/penny-2014-09-03-14:37.12.pdf tar: ./share/pdf/.directory: Cannot open: Permission denied ./share/pdf/penny-2014-09-02-14:52.06.pdf ./share/pdf/penny-2014-09-03-12:18.43.pdf tar: ./share/PDF: Cannot open: Permission denied ./share/file3 tar: ./share/.directory: Cannot open: Permission denied ./dir1/ ./dir1/file1 ./file4 ./file2 ./file3 tar: ./.directory: Cannot open: Permission denied ./list tar: Exiting with failure status due to previous errors
It seems that it is trying to tar all the files in that directory. When I view the files in backup.tar.gz all of the files from /export are in there not just the modified ones