find /var/log/allapps/apps1 | egrep '2013-12-02' | rsync -Ravz --files-from=- / /tmp/testAbove command will create a directory structure of var/log/allapps/apps1 + files(filtered by egrep above) inside apps1 dir inside /tmp/test along with all directories/files ownership and permissions intact.
Now take the backup of above copied folder.
cd /tmp/test tar -cvpf test.tar var
Copy only specified files using rsync.
We need to copy only some files from remote system. These files are scattered around various directories. We also need to keep the directory structure on destination same as in source. Following command was used.
rsync --stats --progress -rvpogStDL --files-from=192.168.1.4:/tmp/200901files 192.168.1.4:/home/remote_files_and_documentsNote1: /tmp/200901files contains list of files.
e.g.
file1 dir2/dir3/file2 dir6/file4
Note2: Source files are in local machine. But the list of files which are to be copied is being fetched from remote machine.
No comments:
Post a Comment