Created
April 21, 2023 05:51
-
-
Save peterhellberg/559468bd66fdf5bbf1954856946e7a8e to your computer and use it in GitHub Desktop.
Taildrop: Receive file into temporary directory, change ownership, move to target directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
user=peter | |
group=peter | |
target=/home/$user/Downloads/Taildrop/ | |
tmpdir=$(mktemp -d '/tmp/taildrop.XXXXXX' 2>/dev/null || mktemp -d -t 'taildrop') | |
if [ -z "$tmpdir" ] | |
then | |
echo "Could not create temporary directory" | |
else | |
sudo tailscale file get $tmpdir | |
sudo chown -R $user:$group $tmpdir | |
mkdir -p $target | |
mv $tmpdir/* $target/ | |
rmdir $tmpdir | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment