Using Find with an exclude/exclude file
I am familiar with using tar and exclude/include files:
Code:
tar zcf backup.dirs.tgz --files-from=include.mydirs --exclude-from=exclude.mydirs --no-recursion Code:
Code:
find (read from include file) (read from exclude file) | cpio -oavc > somedir Code:
find /home/testuser/ \( ! -iname "testdir1*" ! -iname "testdir2*"\) |
As a thought, have you looked at using rsync?
HTH. Let us know. |
Many thanks for the reply
It looks promising, do you know if the compression on the archive is as good or better that using tar or cpio? I am concerned about spacing issues. Regards |
it can be done using grep:
Code:
find ... | grep -v -f excludefile | grep -f includefile | cpio ... |
Just an update:
Code:
find ... | grep -f includefile | cpio -oavc > /some/destination |
This worked better
Code:
find / -depth -ipath '/home/testuser/.*' -prune -o -print| grep -f include.mydirs | grep -v -f exclude.mydirs Code:
|
it did work. I made an adjustment in my exclude.mydir. i was blocking my test directory.
|
By the way, you can use several directories in find. Including only the directories you want to backup, you may not need a long exclude list
find /home/mydir /var/ ... |
Just wanted to add a note so that other users may have a better understanding of my headaches:
Code:
sudo find / -depth ! -path '*/\.*' -iname '*' -type f | grep -f include_home | grep -v -f exclude_home Code:
! -path '*/\.*' ex. just a snippett of the results Code:
sudo find / -depth ! -path '*/\.*' -iname '*' -type f | grep -f include_home Code:
home/testuser/transfer/ Code:
#home/ Code:
sudo find / -depth ! -path '*/\.*' -iname '*' -type f | grep -f include_home | grep -v -f exclude_home |
All times are GMT -5. The time now is 03:37 PM. |