Check if the archive already exist and exit
This commit is contained in:
parent
71b1392dce
commit
86ef4f31d3
|
@ -37,7 +37,13 @@ tar_file_name="${date_year}.${current_dir}${xz_compression_lvl}.tar.xz"
|
|||
|
||||
# }}}
|
||||
|
||||
# If archive already exists
|
||||
if [ -s "${tar_file_name}" ]; then
|
||||
printf "${c_redb}%-6b${c_reset}\n" "${tar_file_name} already exists. Please manage this directory manually or remove the archive and restart."
|
||||
exit 1
|
||||
else
|
||||
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "Create an archive for ${current_dir} files between ${date_start} and ${date_end} using XZ's compression level : ${xz_compression_lvl}."
|
||||
fi
|
||||
|
||||
## Get the list of files between the 2 dates and ignore tar files
|
||||
find . -type f -newermt "${date_start}" -not -newermt "${date_end}" -not -iname "*.tar*" -print0 | tar cJf "${tar_file_name}" --null -T -
|
||||
|
|
Loading…
Reference in New Issue