show types and dates with stat

This commit is contained in:
2020-01-28 15:29:34 +02:00
parent 2ae911f547
commit f34f476ea3

View File

@@ -63,14 +63,16 @@ _list() {
IFS=$'\n' IFS=$'\n'
while read n; do while read n; do
size=$( du -k -h -s --apparent-size "$n" | awk '{ print $1 }' ) size=$( du -k -h -s --apparent-size "$n" | awk '{ print $1 }' )
type=f type=$( stat --printf "%A" "$n" )
if [[ -d "$n" ]]; then type=d; fi type=${type:0:1}
date=$( date -r "$n" -Iseconds ) if [[ "$type" = "-" ]]; then type=f; fi
date="${date::-6}" date=$( stat --printf "%y" "$n" )
if [[ "$date" = "$now"* ]]; then if [[ "$date" = "$now"* ]]; then
date=${date#*T} date=${date#* }
date="${date:0:8}"
else else
date=${date%T*} date=${date%% *}
#~ date="${date:0:8}"
fi fi
printf "%1s %5s %10s %s%s%s\n" \ printf "%1s %5s %10s %s%s%s\n" \
"${type}" \ "${type}" \
@@ -129,7 +131,7 @@ _write_files() { # name, file
echo Copying "${2}$to" echo Copying "${2}$to"
cp -aT "$2" "$STORAGE/$1" cp -aT "$2" "$STORAGE/$1"
fi fi
touch "$STORAGE/$1" touch -h "$STORAGE/$1"
} }
_write_stdin() { # name _write_stdin() { # name