No empty dir in tar log

The name of the picture


No empty dir in tar log



Hi I'm writing a shell for backup the file in my system that are changed after yesterday.
The tar logfile is scanned and every row goes in an oracle database table.



The problem is that when the tar find a directory without file, it puts the directory in the logfile.



My command is:


for DIR in $( cat ${INCLUDE_FILE} )
do
tar -cvzf ${FILE_TAR} ${DIR} --exclude-from=${EXCLUDE_FILE} --after-date="${YESTERDAY}" > ${OUTFILE_OK} 2> ${OUTFILE_KO}
done



Where


INCLUDE_FILE -> file with system dir (every dir have a different tar)
FILE_TAR -> path/of/the/tar.tgz
EXCLUDE_FILE -> file with system dir to exclude from backup
YESTERDAY -> Yesterday date
OUTFILE_OK -> Log
OUTFILE_KO -> Error log



For example the dir /etc/cron.weekly/ doesn't have file changed but this dir goes in the tar log.





please complete your question with put value of all your variables.
– Hossein Vatani
4 hours ago





Don't show us the documentation, show us the real code (with simplified data if need-be) , i.e. INCLUDE_FILE="/path/to/include/myFile.h, etc. Not that if you have spaces in your assigned values, you need to surround them in dbl-quotes as in this example. Good luck.
– shellter
47 mins ago




INCLUDE_FILE="/path/to/include/myFile.h









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Keycloak server returning user_not_found error when user is already imported with LDAP

PHP parse/syntax errors; and how to solve them?

How to scale/resize CVPixelBufferRef in objective C, iOS