Initial program

master
Cole Deck 4 years ago
parent bcd859d72b
commit c3da5af055

14
add

@ -0,0 +1,14 @@
#!/bin/bash
set -euo pipefail
mkdir -p .paths
for file in $@
do
dir=./$(readlink -f "$file" | xargs dirname)
name=$(basename "$file")
echo "$(readlink -f $file)"
sudo mv "$file" "$(pwd)"
sudo ln -s "$(pwd)/$name" "$file"
echo $(echo $dir | cut --complement -b 1-2) > ".paths/$name"
#echo "$name moved."
done

15
unadd

@ -0,0 +1,15 @@
#!/bin/bash
set -euo pipefail
for file in $(ls ./.paths)
do
dir=$(cat ./.paths/$file)
sudo mkdir -p "$dir"
echo "$dir/$file"
sudo unlink "$dir/$file" 2>&1 > /dev/null
sudo mv "$file" "$dir"
sudo rm ./.paths/$file
done
if [ -z "$(ls ./.paths)" ]; then
sudo rmdir ./.paths
fi
Loading…
Cancel
Save