Summary Files Commits Branches @commit @diff @stats
path: root / scripts / unarchive
diff options
context:
space:
mode:
Commite5823c8bc7cadeb97f55327c38b0ee91098e0ca2 (patch)
Author
 Syndamia <kamen@syndamia.com>
2026-11-08 19:01:47 +0200
Committer
 Syndamia <kamen@syndamia.com>
2026-11-08 19:01:47 +0200
Filesa27ac86e01d53edb4c972efab86b5e132c806c83 /scripts/unarchive
cli-e5823c8bc7cadeb97f55327c38b0ee91098e0ca2.tar
cli-e5823c8bc7cadeb97f55327c38b0ee91098e0ca2.tar.gz
cli-e5823c8bc7cadeb97f55327c38b0ee91098e0ca2.zip
Parent709a50ab8fc61395182500b6815dccf9aba40b47 (diff)
feat(scripts): Implement archive and unarchive
1 files changed, 29 insertions, 0 deletions
-rwxr-xr-xscripts/unarchive29
diff --git a/scripts/unarchive b/scripts/unarchive
new file mode 100755
index 0000000..08688da
--- /dev/null
+++ b/scripts/unarchive
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+if [ -z "$1" ]
+then
+ printf 'Repository: '
+ read
+ set "$REPLY"
+fi
+
+set "$(echo -e "a\n$1\n.\n1s|\.\+/||g\n1s|/\+|/|g\n1p\nQ" | ed -s)"
+
+if [ ! -d "$1" ]
+then
+ echo 'Not a directory!'
+ exit 1
+fi
+
+__rec_ro() {
+ while read -r f
+ do
+ [ ! -w "$f" ] && continue
+ chwrite +w "$f"
+ [ -d "$f" ] && __rec_ro "$f"
+ done <<FILES
+$(ls -A1 "$1")
+FILES
+}
+
+__rec_ro "$1"