Skip to content

Commit

Permalink
bk(): Remove the separators between the units of time
Browse files Browse the repository at this point in the history
In PR/60 we discussed the use of the local timezone instead of UTC. While doing
so we figured out that the current implementation is broken on VFAT.

This solution removes the delimiters between the units of time which is fully
IS0 8601 compliant and should work well on all filesystems.
  • Loading branch information
jkirk committed Jun 14, 2018
1 parent 0f6d65b commit 4bf72e3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions etc/zsh/zshrc
Expand Up @@ -3268,7 +3268,7 @@ fi
#f5# Backup \kbd{file_or_folder {\rm to} file_or_folder\_timestamp}
function bk () {
emulate -L zsh
local current_date=$(date -u "+%Y-%m-%dT%H:%M:%SZ")
local current_date=$(date -u "+%Y%m%dT%H%M%SZ")
local clean keep move verbose result all to_bk
setopt extended_glob
keep=1
Expand Down Expand Up @@ -3325,14 +3325,14 @@ return 0;;
elif (( clean > 0 )); then
if (( $# > 0 )); then
for to_bk in "$@"; do
rm $verbose -rf "${to_bk%/}"_[0-9](#c4,)-(0[0-9]|1[0-2])-([0-2][0-9]|3[0-1])T([0-1][0-9]|2[0-3])(:[0-5][0-9])(#c2)Z
rm $verbose -rf "${to_bk%/}"_[0-9](#c8)T([0-1][0-9]|2[0-3])([0-5][0-9])(#c2)Z
(( result += $? ))
done
else
if (( all > 0 )); then
rm $verbose -rf *_[0-9](#c4,)-(0[0-9]|1[0-2])-([0-2][0-9]|3[0-1])T([0-1][0-9]|2[0-3])(:[0-5][0-9])(#c2)Z(D)
rm $verbose -rf *_[0-9](#c8)T([0-1][0-9]|2[0-3])([0-5][0-9])(#c2)Z(D)
else
rm $verbose -rf *_[0-9](#c4,)-(0[0-9]|1[0-2])-([0-2][0-9]|3[0-1])T([0-1][0-9]|2[0-3])(:[0-5][0-9])(#c2)Z
rm $verbose -rf *_[0-9](#c8)T([0-1][0-9]|2[0-3])([0-5][0-9])(#c2)Z
fi
(( result += $? ))
fi
Expand Down

0 comments on commit 4bf72e3

Please sign in to comment.