Really basic script

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
part timer
Posts: 181
Joined: 09 May 2012, 23:35

Really basic script

Post by part timer »

So I know what I am asking for is simple day 1 groovy code, but scripting and I don't really get along. I'm looking for a script that I can point at one of my movie directories and grab a list of all folders with a video file in them and does not contain the files folder.jpg & poster.jpg& movie.tbn and then print the full path to the folder to my log file as I have no easy way right now to figure out which have all 3 except checking manually. Perfect for a script to do.

Thanks for reading
User avatar
rednoah
The Source
Posts: 22991
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Really basic script

Post by rednoah »

Something like:

Code: Select all

args.getFolders().findAll{ it.hasFile{ it.isVideo() } && (!it.hasFile{ it =~ /folder.jpg/ } || !it.hasFile{ it =~ /poster.jpg/ } || !it.hasFile{ it =~ /movie.tbn/ }) }
:idea: Please read the FAQ and How to Request Help.
part timer
Posts: 181
Joined: 09 May 2012, 23:35

Re: Really basic script

Post by part timer »

Awesome! Thank you for the fast response. I haven't been able to try the script out yet, but I think I need to tweak it. I want all my folders to have those 3 files folder.jpg & poster.jpg & movie.tbn and I want to know all of the folders that DO NOT contain all 3.

So I guess I need a script that checks folders that don't have 1 OR the other OR the other (any folder that is missing at least one) and only list the folders once. Then I'll throw it to a log file.

I hope this makes sense and I think I just need an OR statement between each, right?

As always thank you again so much!!
User avatar
rednoah
The Source
Posts: 22991
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Really basic script

Post by rednoah »

It's working how you want: hasVideoFile AND ( not hasFile A OR not hasFile B OR not hasFile C )
:idea: Please read the FAQ and How to Request Help.
Post Reply