Skip to content

Commit f210a47

Browse files
committed
check for file presence
1 parent a08c00c commit f210a47

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

share/github-backup-utils/ghe-prune-snapshots

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,20 @@ prune_snapshot() {
1717
# ignore any directory that is included in inc_full_backup or inc_snapshot_data
1818
# the files should be filtered out earlier, but this is a safeguard to make sure.
1919
# inc_previous_* and prune_inc_previous are ignored by default
20-
if grep -q "$prune_dir" "$GHE_DATA_DIR/inc_full_backup" || grep "$prune_dir" "$GHE_DATA_DIR/inc_snapshot_data"; then
21-
continue
20+
if [ -f "$GHE_DATA_DIR/inc_full_backup" ]; then
21+
if grep -q "$prune_dir" "$GHE_DATA_DIR"/inc_full_backup; then
22+
log_info "Skipping incremental backup directory: $prune_dir" 1>&3
23+
continue
24+
fi
25+
fi
26+
27+
if [ -f "$GHE_DATA_DIR/inc_snapshot_data" ]; then
28+
if grep -q "$prune_dir" "$GHE_DATA_DIR"/inc_snapshot_data; then
29+
log_info "Skipping incremental backup directory: $prune_dir" 1>&3
30+
continue
31+
fi
2232
fi
33+
2334
# skip if the directory is not a directory or blank
2435
if [ ! -d "$prune_dir" ] || [ -z "$prune_dir" ]; then
2536
log_info "Skipping blank or non-directory: $prune_dir" 1>&3

0 commit comments

Comments
 (0)