Page 1 of 2
Move files into alphabetically named folders
Posted: April 25th, 2012, 5:21 pm
by Faintuk
Just wondering if it's possible to have a script move film files to a specific folder based on the alphabet?
Eg Scream 4 would get moved to e:\movies\s\
Avatar would get moved to e:\movies\a\
Cheers
Re: Move files into alphabetically named folders
Posted: April 25th, 2012, 5:55 pm
by sander
And what about
"(1234/1231) Supermovie 2"
"12-04-2011 Theme"
... where should these movie files go ... ?
Oh, which OS?
Re: Move files into alphabetically named folders
Posted: April 25th, 2012, 6:23 pm
by Faintuk
Im using windows
And I guess movies with numbers in could go into a folder called 0-9
Cheers
Re: Move files into alphabetically named folders
Posted: April 26th, 2012, 12:58 am
by sander
Ah, Windows. Sorry, I have Linux.
Proof of Concept on Linux:
Code: Select all
echo '[[389/2323]] Nice Movie' | tr -c -d 'a-zA-Z0-9' | awk '{ print toupper(substr($1,1,1)) }'
will return "3", so that's good.
Explanation:
the 'echo' prints an example NZB name. In the script, it should be $2
the 'tr' removes strange characters only leaving letters and numbers.
the 'awk' takes the first letter, and turns it to upper case
As Windows has no tr and awk, you cannot run this on Windows.
Re: Move files into alphabetically named folders
Posted: April 26th, 2012, 5:07 pm
by Faintuk
i found this website that gives a script that will do what im after just wondering if anyone could modify this to run in sab
http://www.roysac.com/blog/2009/03/file ... anization/
cheers
Re: Move files into alphabetically named folders
Posted: July 4th, 2012, 11:52 am
by NoTolerance
This would be fairly simple to do. Still something you're after?
Re: Move files into alphabetically named folders
Posted: July 4th, 2012, 12:06 pm
by Faintuk
Yes this is still something I'd want to get working
Thanks
Re: Move files into alphabetically named folders
Posted: July 4th, 2012, 1:35 pm
by NoTolerance
How do you want to handle folders that start with "The"?
The Most Awesome Movie Ever Made
Most Awesome Movie Ever Made, The
Re: Move files into alphabetically named folders
Posted: July 4th, 2012, 3:08 pm
by NoTolerance
I just set it up both ways, giving you the option, since I had to include an INI file anyway.
Give
this a try.
Put the AlphaSort.exe and AlphaSort.ini into your sab scripts folder. Edit the AlphaSort.ini file. Be sure to put quotes around the path name and use a trailing backslash: "E:\Movies\"
Re: Move files into alphabetically named folders
Posted: September 21st, 2012, 3:55 pm
by friet
Tried it but it doesn't work. Put this in the Post-Processing Scripts Folder and edited the ini file but nothing happens. (And yes, I have tried turning it off and on again.)
edit: Now I'm getting this:
Exit(1) You need to specify your final destination directory in the INI file.
Re: Move files into alphabetically named folders
Posted: September 21st, 2012, 7:54 pm
by NoTolerance
I have to ask the obvious: Did you specify a final destination directory in the INI file?
Can you expand the log (click More) and paste what it says? It might be useful if you post a copy of your completed INI file, too.
Or you can email me this info: NoTolerance <at> gmail <dot> com
Re: Move files into alphabetically named folders
Posted: September 24th, 2012, 2:53 pm
by friet
The log:
Code: Select all
Making sure NZB was processed successfully...
Sab NZB processing completed without error. Preparing to process...
You need to specify your final destination directory in the INI file.
My ini file:
Code: Select all
[Paths]
;===========================================================================
; Full Path to Final Destination Directory - Use Trailing Backslash
; Example: "D:\Movies\"
;===========================================================================
FinalDir="G:\Downloads\Complete\"
[Renaming]
;===========================================================================
; Move 'The' to end of folder name. 0 = NO, 1 = YES
; Example: The Greatest Movie Ever
; 0 = D:\Movies\T\The Greatest Movie Ever
; 1 = D:\Movies\G\Greatest Movie Ever, The
;===========================================================================
RenameThe=0
In the sabnzbd config I have the same destination folder: G:\Downloads\Complete\
Re: Move files into alphabetically named folders
Posted: September 27th, 2012, 2:59 pm
by NoTolerance
What is the path to your INI file? It looks for it in the \scripts folder (e.g. C:\Program Files\sabnzbd\scripts\AlphaSort.ini) by default.
In Sab, under Config - Folders, what do you have listed for the Post-Processing Scripts Folder?
Based on the error, it's not able to read the INI file. The only reason this should happen is if the INI file and the EXE aren't in the same directory.
This isn't currently causing you an issue (because it's not getting that far), but you *may* have an issue with your final destination directory being the same as your completed download directory. I didn't really test it that way when I whipped it together.
Re: Move files into alphabetically named folders
Posted: September 28th, 2012, 3:26 pm
by friet
Thanks for the help but unfortunately it still doesn't work. I changed the destination folder in the ini file to a new folder (so no longer my completed folder). The scripts folder is correct in the config and the exe and ini are in the same folder.
This is what I have in config - categories:
It picks up the script, so that folder must be correct.
Re: Move files into alphabetically named folders
Posted: October 1st, 2012, 9:44 am
by NoTolerance
friet wrote:Thanks for the help but unfortunately it still doesn't work. I changed the destination folder in the ini file to a new folder (so no longer my completed folder). The scripts folder is correct in the config and the exe and ini are in the same folder.
This is what I have in config - categories:
It picks up the script, so that folder must be correct.
I think I know what I did wrong. I'm working on a fix and will have it posted shortly.