share files over local network with python's http.server
This commit is contained in:
parent
d84b397335
commit
2fabe40e9d
2 changed files with 16 additions and 1 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -12,7 +12,7 @@ lutris
|
||||||
pcmanfm
|
pcmanfm
|
||||||
pulse
|
pulse
|
||||||
surf/
|
surf/
|
||||||
darktable
|
darktable/
|
||||||
galculator
|
galculator
|
||||||
kalgebrarc
|
kalgebrarc
|
||||||
kdenlive-layoutsrc
|
kdenlive-layoutsrc
|
||||||
|
|
15
scripts/share
Executable file
15
scripts/share
Executable file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
help() {
|
||||||
|
printf "\033[2mUsage:\033[0m share [DIRECTORY/FILE]\n"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
LOC="$1" ; [ -n "$LOC" ] || help
|
||||||
|
TEMP_DIR="/tmp/sharedir"
|
||||||
|
|
||||||
|
[ -d "$LOC" ] && DIR="$LOC" || DIR="$TEMP_DIR"
|
||||||
|
[ "$DIR" = "$TEMP_DIR" ] && mkdir -p "$TEMP_DIR" && cp -f "$LOC" "$DIR/"
|
||||||
|
|
||||||
|
python -m http.server -b 0.0.0.0 8000 -d "$DIR"
|
||||||
|
[ "$DIR" = "$TEMP_DIR" ] && rm -rf "$DIR"
|
Loading…
Reference in a new issue