diff options
author | xyz <gky44px1999@gmail.com> | 2021-08-13 16:05:23 -0700 |
---|---|---|
committer | xyz <gky44px1999@gmail.com> | 2021-08-13 16:05:23 -0700 |
commit | a5b58972bfcea12b608871f7d4c9a147943f3320 (patch) | |
tree | 635dc6a87f38e9da96ad4d30f8612ddc71ea1d27 /.local | |
parent | bbb00154c123604467287e0c6038550cdccbfad7 (diff) |
refactor
Diffstat (limited to '.local')
-rwxr-xr-x | .local/bin/orgext | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/.local/bin/orgext b/.local/bin/orgext index 103d8a77..ed53c271 100755 --- a/.local/bin/orgext +++ b/.local/bin/orgext @@ -1,6 +1,7 @@ #!/bin/sh # can improve by passing $@ to functions, but seems need bashism, or abandon functions -# maybe use $1 for getext and use getopts, maybe seperate getext as another script, maybe add option for using ln instead of mv +# maybe seperate find extension part and output names as another script with options of recursive or not +# maybe add option for using ln instead of mv # references: # https://stackoverflow.com/questions/1842254/how-can-i-find-all-of-the-distinct-file-extensions-in-a-folder-hierarchy @@ -11,6 +12,7 @@ outdir () } # may further optimize by output file extension names to a variable and use it for both mkdir and mv, current is fast enough for me +# maybe better if make all uppercase to lowercase, is it possible to use awk for that? indir () { find . -maxdepth 1 -type f | awk -F. '!a[$NF]++{print $NF}' | xargs mkdir |