summaryrefslogtreecommitdiff
path: root/.scripts/order
diff options
context:
space:
mode:
authorSaumit Dinesan <justsaumit@protonmail.com>2022-07-05 12:04:34 +0530
committerSaumit Dinesan <justsaumit@protonmail.com>2022-07-05 12:04:34 +0530
commit2be1b55c588b3afeeb6f6d8dc337b76ed3357631 (patch)
tree573dd2a49a3ba2902ac88580cf4d7c77929084bf /.scripts/order
parentf9b57f6ae4dd8e70f8f5096e1f51dfd2ff1d807b (diff)
trimming down order script from 3 forloops to one simple while loop
Diffstat (limited to '.scripts/order')
-rw-r--r--.scripts/order13
1 files changed, 1 insertions, 12 deletions
diff --git a/.scripts/order b/.scripts/order
index 1b6eff5..bfd6947 100644
--- a/.scripts/order
+++ b/.scripts/order
@@ -3,15 +3,4 @@
noofdirs=$(find . -mindepth 1 -maxdepth 1 -type d | wc -l)
lenofnod=$(echo -n "$noofdirs" | wc -m) ## Flag n to prevent newline count
-for f in * ;
-do mv -n "$f" "$(date -r "$f" +"%Y%m%d_%H%M%S")_$f";
-done
-
-##open in vimv
-#let @a=1 | g/^.\{0,16}/s//\=i.'. ' | let i=i+1
-#add zero in front use period to repeat as necess
-
-i=1;
-for d in * ;
-do echo $d $i ; mv -n "$d" "$(ls | nl -w$lenofnod -s ". " -n rz | awk -v i=$i 'NR==i')" ; i=$((i+1));
-done
+ls -vtr | nl -w$lenofnod -s ". " -n rz | while read n f; do mv -n "$f" "$n $f" ; done