Can Sonarr Delete Files after Import?

Sonarr version (exact version):
OS: TrueNAS Scale
Debug logs: hastebin
Description of issue: Sonarr keeps downloads after import

I have a remote Seedbox and I run Sonarr locally on my NAS. I have a script to download the finished Seedbox files to the local NAS. I mapped the remote paths correctly and have turned off hardlinking. Sonarr imports the files just fine but keeps the local downloaded files. Is there a way to have Sonarr remove the local downloaded files? They are redundant since they are imported / moved to my media library.

You can do so with a custom script, but Sonarr doesn’t have anything built in to achieve that currently.

Thanks for the reply!

I guess I can make a custom script that runs every night and purges the local downloads folder. I suppose I would need to figure out a way to make sure the files are not in use / being downloaded. It would be suboptimal if the script purges the folder while a download is happening.

I was thinking a custom script that Sonarr executes after the file is imported (it’d be called for each file), but might need a nightly script to clean up empty subfolders.

Yea that would be more ideal to call a script after an import. I see there is a custom script option in the connections and I can just trigger it on import. So i’ll peruse the idea down that route.

Thanks for the help :slight_smile:

Is it possible to somehow just selectively delete the files that have been imported?

I have tried to create a custom script under connections but from what I can see, it will just run a script on import of media files. Is there a way to pass the script the file names that have been imported? I feel like I am missing something :sweat_smile:

Sonarr will set environment variables with the episode/file/… info. Your script can parse those to take appropriate actions.

Just what I was looking for, thanks a lot :+1:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.