AMC - Deleting ut_dir folder after moving files

Running FileBot from the console, Groovy / FileBot scripting, shell scripts, etc
Post Reply
vondawe
Posts: 3
Joined: 16 Apr 2013, 23:01

AMC - Deleting ut_dir folder after moving files

Post by vondawe » 18 Apr 2013, 02:47

You sir, are a genius!
Filebot is simply the best software for renaming, moving and sorting media files i have ever had the pleasure to use. Just beats them all :)

Now to the case!
I'm using the amc.groovy script along with uTorrent.
It works absolutely fine most of the time but for me it's not fully automated yet.
Is there a way of modyfing the script to delete the ut_dir folder after it has processed the media files? Because when extracting archives amc just leaves the archives in the uTorrent "completed" folder. I don't want to clean the whole completed folder in case there are any other files that i don't want deleted.

I could maybe use the "-- def exts" to point the cleaner to the archives but in some other cases there are empty folders that are not deleted.

I'm a total beginner when it comes to programming but if you point me in the right direction i might be able to figure it out. I've tried everything I can think of and i really need your help.

This is the command i run from uTorrent ->

Code: Select all

"C:\Program Files\Filebot\FileBot.exe" -script fn:amc --output "X:/path/to/media" --log-file "C:\Program Files\Filebot\amc.log" --action move --conflict override -non-strict --def "seriesFormat=D:/Media 2/TV Shows/{n.upperInitial().space(\" \")}/{\"Season $s\"}/{fn}" --def "movieFormat=D:/Media 2/Movies/{n} {y}/{fn}" --def music=n --def subtitles=n --def artwork=n --def backdrops=n --def clean "ut_dir=%D" "ut_file=%F" "ut_kind=%K" "ut_title=%N" "ut_label=%L" "ut_state=%S" 
Thank you for your time! :D

User avatar
rednoah
The Source
Posts: 16940
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC - Deleting ut_dir folder after moving files

Post by rednoah » 18 Apr 2013, 03:09

This should do it:

Code: Select all

--def clean=y
Clean up after extracted files that are not needed anymore after COPY or HARDLINK.


Now I don't understand why you would wanna delete the ut_dir folder, since you're seeding you can't use MOVE or delete things you're seeding. Also keep in mind that ut_dir will be your downloads folder for single-file torrents.

You can probably add a call to the cleaner script for whatever special cleanup requirements you have that are not handled by default via --def clean=y. The cleaner will always delete empty folders.
:idea: Please read the FAQ and How to Request Help.

vondawe
Posts: 3
Joined: 16 Apr 2013, 23:01

Re: AMC - Deleting ut_dir folder after moving files

Post by vondawe » 18 Apr 2013, 15:49

My uTorrent command actually says --def clean=y. Must have messed it up when i pasted the code here.

Im fully aware of that I can't both MOVE / delete what i download and keep seeding.

The problem only occurs when the torrent consists of Archives or a folder with folders like this --> "X:\Completed\Torrentfolder\folder1\folder2"

When it's a single-file torrent it all works like a charm. The script moves the video file and then, if the video file was inside a folder, it deletes the folder and any rubbish inside of it, given that there is not multiple layers of folders inside of the original folder.

When there is multiple layers of folders inside of a folder containing for example, subtitles, it only deletes the last empty folder in the path. For example:

"X:\Completed\Never.back.down.2.2011\Subtitles\Subtitles.EN\"
"X:\Completed\Never.back.down.2.2011\EmptyFolder1\EmptyFolder2\"

In these two paths only the folders "Subtiles.EN" and "EmptyFolder2" will be deleted.

When the torrent consists of archives everything except the torrent folder and the original archives inside the torrent folder is deleted.

The thing i want to accomplish is deleting the specific file(s)/folder(s) that each torrent downloads after the files have been processed. If there are any left after the script has been executed. Or simply make sure that any archives and folders (no matter if they're empty or not) will be deleted by the cleaner.

User avatar
rednoah
The Source
Posts: 16940
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC - Deleting ut_dir folder after moving files

Post by rednoah » 18 Apr 2013, 16:12

Sometimes the there'll be video files left behind that couldn't be processed. The gist of the cleaner is to only delete clutter and empty folders, but never touch anything when there's still video files around.

Fixed the nested empty folders issue. There rest will be up to your own mods.
:idea: Please read the FAQ and How to Request Help.

Post Reply