Sonarr version (exact version): 3.0.8.1507
Mono version (if Sonarr is not running on Windows): 6.12.0.122
OS: Ubuntu 20.04 LTS
Debug logs: N/A (for a new script)
Description of issue: Script environment variable for mkdir for new seasons within existing series
Additional Information:
Can someone with far better scripting skills help me? I currently use a simple bash script to copy episodes to a mirror location through Connect.
#!/bin/bash
cp -p “$sonarr_episodefile_path” “{$sonarr_episodefile_path/tvshows/tvshowsbu}”
This takes the original path of:
/media/tvshows/TV Shows/Series/Season/Episode file.xxx
and substitutes tvshowsbu for tvshows as intended and copies it to:
/media/tvshowsbu/TV Shows/Series/Season/Episode file.xxx
It works great until a new season requires a new directory to be be created. Previously I manually created the new seasons, but this has gotten to be very tedious and I want to create the season directory on demand. I have been trying to figure out the correct “environment variable for season” and modify to something like:
#!/bin/bash
File=“environment variable for season”
if [ ! -d “FILE” ]
then
mkdir -p “FILE” && cp -p “$sonarr_episodefile_path” “$sonarr_episodefile_path/tvshows/tvshowsbu}”
else
cp -p “$sonarr_episodefile_path” “{$sonarr_episodefile_path/tvshows/tvshowsbu}”
fi
Even once the environment variable for the season is figured out, I am pretty sure this is not the cleanest bash script in the world. Any advise from those far more knowledgeable in scripting would be greatly appreciated.