local/bin/dataindex: Skip version control and encfs-encrypted folders
parent
63c0201060
commit
c303b90aad
|
@ -8,6 +8,8 @@ Output index of folder hierarchies to stdout. This is used as a small "backup"
|
|||
purpose. In case of data loss, it is still possible to get the full file list
|
||||
thanks to the indexes.
|
||||
|
||||
Version control and encfs-encrypted folders are skipped.
|
||||
|
||||
Options:
|
||||
|
||||
-f: When outputting to a file, overwrite if it exists.
|
||||
|
@ -48,6 +50,7 @@ fi
|
|||
|
||||
for i ; do
|
||||
[ ! -d "$i" ] && continue
|
||||
[ -e "$i"/.encfs*.xml ] && continue
|
||||
|
||||
## We strip "./" from find's listing since we don't need it. We could avoid
|
||||
## printing it in the first place, but there are several shortcomings:
|
||||
|
@ -60,7 +63,7 @@ for i ; do
|
|||
|
||||
## The two following lines do the same for the same time cost. The former is shorter.
|
||||
# find "$i" -type f | awk -v str="$i" '{l=length(str)+2; print substr($0, l)}' | LC_ALL=C sort > "$OUTPUT"
|
||||
(cd -- "$i" && find . -type f) | sed 's/^.\///' | LC_ALL=C sort | \
|
||||
(cd -- "$i" && find . \( -path '*.git*' -o -path '*.svn*' -o -path '*.hg*' \) -prune -o -type f) | sed 's/^.\///' | LC_ALL=C sort | \
|
||||
if $opt_file; then
|
||||
i="$(realpath -- "$i")"
|
||||
base="${i##*/}"
|
||||
|
|
Loading…
Reference in New Issue