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