sorting across multiple drives - not going to drive that already has the show

All about user-defined episode / movie / file name format expressions
Post Reply
Olympus2208
Posts: 7
Joined: 20 Feb 2017, 05:28

sorting across multiple drives - not going to drive that already has the show

Post by Olympus2208 »

hi

i have been using the below code to have my files sorted by most space drive after checking if it is on a drive already or not, it seems to be putting shows that are already on another drive into a fresh folder on a different drive. i have not noticed this in the past can anyone see why this may be occuring.

Code: Select all

{['F:', 'G:', 'D:', 'K:'].collect{ (it+'/TV/'+n) as File }.sort{ a, b -> a.exists() <=> b.exists() ?: a.diskSpace <=> b.diskSpace }.last()}/{"Season ${s.pad(2)}"}/{s00e00} - {episode}
User avatar
rednoah
The Source
Posts: 23930
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: sorting across multiple drives - not going to drive that already has the show

Post by rednoah »

Well, either n has changed, or File.exists() is not working. The latter is somewhat inconceivable in normal circumstances.


:arrow: My first step would be to debug the code step by step until you find the bit where the actual value is different from the expected value.


e.g. play with the format and see what values you get for your various test cases:

Code: Select all

{
	['F:', 'G:', 'D:', 'K:']
	.collect{ it / 'TV' / n }
	.collect{ [it, it.exists(), it.diskSpace] }
}
:idea: Please read the FAQ and How to Request Help.
Olympus2208
Posts: 7
Joined: 20 Feb 2017, 05:28

Re: sorting across multiple drives - not going to drive that already has the show

Post by Olympus2208 »

The only thing not working is f drive contains a sub folder that should direct filebot to send files there but while G is part of script it wants to sen them there i remove g And f works perfectly with the duplicate file error. Any incite would be great i am not very proficient at this.
User avatar
rednoah
The Source
Posts: 23930
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: sorting across multiple drives - not going to drive that already has the show

Post by rednoah »

You can use the code posted above to verify your assumptions and figure out why it's not working in this specific case.

Match your files. Double-Click the New Names item in question and open the format editor for testing. The snippet above will help you see what’s going on.
:idea: Please read the FAQ and How to Request Help.
Post Reply