Page 1 of 1

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

Posted: 16 Jul 2020, 05:25
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}

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

Posted: 16 Jul 2020, 05:52
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] }
}

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

Posted: 16 Jul 2020, 11:35
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.

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

Posted: 16 Jul 2020, 12:05
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.