Skip to content

Instantly share code, notes, and snippets.

@claabs
Created May 25, 2026 21:50
Show Gist options
  • Select an option

  • Save claabs/9962bb2da9e6ab8d0a4a5e3b8f2d7267 to your computer and use it in GitHub Desktop.

Select an option

Save claabs/9962bb2da9e6ab8d0a4a5e3b8f2d7267 to your computer and use it in GitHub Desktop.
A service to move newly saved gpu-screen-recorder-ui replays from a write-heavy capable disk (e.g. Optane SSD) to a larger disk.
#!/bin/bash
SOURCE_DIR="/mnt/optane/TempRecordings"
DEST_DIR="$HOME/Videos/Replays"
mkdir -p "$DEST_DIR"
# Monitor for directory creation
inotifywait -m -e create --exclude "^gsr-replay-.*\.gsr" --format '%f' "$SOURCE_DIR" | while read NEW_ITEM
do
echo "File created: $NEW_ITEM"
sleep 2
rsync -av --remove-source-files \
--exclude='gsr-replay-*' \
"$SOURCE_DIR/" "$DEST_DIR"
# Clean up empty directories left behind on the Optane drive
find "$SOURCE_DIR" -type d -empty -not -path "$SOURCE_DIR" -delete
done
# Place in ~/.config/systemd/user/gsr-watcher.service
[Unit]
Description=Watch and move non-replay GSR recordings
After=graphical-session.target
[Service]
ExecStart=/home/<username>/.local/bin/gsr-move-recordings.sh
Restart=on-failure
RestartSec=5
[Install]
WantedBy=default.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment