Small collection of Bash scripts to launch functionalities in folders when new files appear, such as optimizing videos, converting images or battery management.
Go to file
Andros Fenollosa eb7ede87e6 Fix text
2023-04-18 16:48:54 +02:00
dynamic-folders-decompress.sh Update filename 2023-04-18 12:59:54 +02:00
dynamic-folders-image-to-webp.sh Update filename 2023-04-18 12:59:54 +02:00
dynamic-folders-random-image.sh Update filename 2023-04-18 12:59:54 +02:00
dynamic-folders-share-files.sh Update filename 2023-04-18 12:59:54 +02:00
dynamic-folders-video-optimizer.sh Update event 2023-04-18 15:32:42 +02:00
LICENSE Initial commit 2023-03-21 19:06:21 +01:00
README.md Fix text 2023-04-18 16:48:54 +02:00

Dynamic folders

Collection of Bash scripts that execute functionalities in folders.

Video optmizer

Folder that watches when new videos are added and optimizes them.

Requirements

  • inotify-tools
  • ffmpeg

Example in Debian.

sudo apt install inotify-tools ffmpeg

Install

curl -o dynamic-folders-video-optimizer https://raw.githubusercontent.com/tanrax/dynamic-folders/main/dynamic-folders-video-optimizer.sh && chmod +x dynamic-folders-video-optimizer && sudo mv dynamic-folders-video-optimizer /usr/local/bin && echo "🎉 Successfully installed! 🎉"

Test

dynamic-folders-video-optimizer --help

Run

dynamic-folders-video-optimizer --folder [folder to watch]

Example.

mkdir optimizer
dynamic-folders-video-optimizer --folder optimizer

And leave a video that you want to optimize in the folder optimizer.

Start at operating system startup

Option 1: Service

Create a file in /etc/systemd/system/dynamic-folders-video-optimizer.service with the following content.

[Unit]
Description=Folder that watches when new videos are added and optimizes them.

[Service]
Restart=always
RestartSec=5
User=[user]
ExecStart=dynamic-folders-video-optimizer --folder [folder to watch]

[Install]
WantedBy=multi-user.target

Edit it to your needs.

Recharge services.

sudo systemctl daemon-reload

And activate it.

sudo systemctl enable dynamic-folders-video-optimizer
sudo systemctl start dynamic-folders-video-optimizer

Option 2: Cron

Open.

crontab -e

Add to document.

@reboot dynamic-folders-video-optimizer --folder [folder to watch] >/dev/null 2>&1 &

Development

Check syntax

shellcheck [script]