Group : Add current year collector.
This commit is contained in:
parent
442040a639
commit
c7c3fae834
|
@ -36,3 +36,22 @@ function group_year() {
|
||||||
|
|
||||||
_iterate_targets process ${targets[@]}
|
_iterate_targets process ${targets[@]}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Copy files from current year to the named dir.
|
||||||
|
function group_year_current() {
|
||||||
|
local IFS=$'\n'
|
||||||
|
local targets=(${@})
|
||||||
|
[[ "${targets}" = "" ]] && targets=($(ls))
|
||||||
|
|
||||||
|
local today="$(date +%Y)"
|
||||||
|
mkdir ${today} 2> /dev/null
|
||||||
|
|
||||||
|
process() {
|
||||||
|
local year=$(stat --format=%y ${target})
|
||||||
|
year=${year%%-*}
|
||||||
|
|
||||||
|
[[ "${year}" = "${today}" ]] && cp -- ${target} ./${today}/
|
||||||
|
}
|
||||||
|
|
||||||
|
_iterate_targets process ${targets[@]}
|
||||||
|
}
|
||||||
|
|
|
@ -211,6 +211,7 @@ Command|Description
|
||||||
---|---
|
---|---
|
||||||
`group_ext [FILES]`|Group files by extension.
|
`group_ext [FILES]`|Group files by extension.
|
||||||
`group_year [FILES]`|Group files and dirs by year.
|
`group_year [FILES]`|Group files and dirs by year.
|
||||||
|
`group_year_current`|Copy files from current year to the named dir.
|
||||||
|
|
||||||
## Help.
|
## Help.
|
||||||
|
|
||||||
|
@ -267,9 +268,10 @@ Command|Description
|
||||||
`nix_unstable`|Switch to Unstable branch.
|
`nix_unstable`|Switch to Unstable branch.
|
||||||
`nix_unstable_small`|Switch to Small Unstable branch (for server).
|
`nix_unstable_small`|Switch to Small Unstable branch (for server).
|
||||||
`nix_channel`|Display current channel.
|
`nix_channel`|Display current channel.
|
||||||
`nix_update`|Update system (rebuild).
|
`nix_update [HOSTNAME]`|Update system (rebuild). Optionally force the hostname.
|
||||||
`nix_upgrade`|Upgrade system.
|
`nix_upgrade [HOSTNAME]`|Upgrade system. Applies after reboot. Optionally force the hostname.
|
||||||
`nix_clean`|Free up root space.
|
`nix_clean`|Free up root space.
|
||||||
|
`nix_shell`|Spawn shell with nix environment, like LD support.
|
||||||
`shell`|Spawn temporary shell.
|
`shell`|Spawn temporary shell.
|
||||||
|
|
||||||
## Notify.
|
## Notify.
|
||||||
|
|
Reference in a new issue