ChickenLipsRfun2eat schrieb:
Cool 😉 aber recursive darfst du nicht nehmen, da die ISOs ja nach Downloads/ISOs gepackt werden.
Stimmt. Ich würde allerdings nicht unterhalb von Download verschieben sondern woanders hin. Es waren auch noch ein paar Syntaxfehler drin.
Eventuell noch ein if [ -f "$file" ]
, um Ordner auszuschließen. Wie oft „feuert“ das Event? Muss ich später mal testen…
Was meinst Du? --monitor stellt sicher, dass inotifywait
endlos läuft. Pro Datei feuert das Event ein Mal.
| #!/bin/sh
inotifywait --monitor -e close_write --format %w%f dir |
while read -r file; do
if [ -f "$file" ]; then
case "$file" in
*.mp4|*.mov) mv "$file" "${file%/*}/Videos";;
*) echo "Skip: $file";;
esac
fi
done
|
Wer's mag auch so
| #!/bin/sh
inotifywait --monitor -e close_write --format %w%f dir |
while read -r file; do
[ -f "$file" ] || continue
case "$file" in
*.mp4|*.mov) mv "$file" "${file%/*}/Videos";;
*) echo "Skip: $file";;
esac
done
|
Edit: Zielpfade nach Problemstellung angepasst.