Ok. First- thanks for even responding. I am grateful.
Second, all I want the code to do is go through a list of folders and identify which is a movie file, music file or TV show by their endings. The Tv shows are different in that they are in a separate TV folder. I attach the screenshot of the folders and the sub folders.
How do I include pictures?
This is a Music subfolder and the usual endings are .mp3 and .mp4 and .vog. .ac* does not play on the linux server so I usually move them into my windows pc and convert them manually.
This was manually sorted and the point is I want this code to look at the terminations and move the folders to the respective folders i.e. Music, TV Shows/TV-HD , TV Shows/TV-SD, Movies/Sub Folder of Movie Name/*
This is a Movies sub folder: http://gavitex.com/share/yflrjc2us
and as you can see the folder structure is a sub folder/sub folders. I can live with that same structure being moved to the movies folder. If I had a choice, I would prefer the code to move all the movies sub folder files into one sub folder so Movies/Sub Folder/Sub Folders become Movies/Sub Folder/.mkv, .nfo, .srt
This is the Comics folder manually sorted. URL=http://gavitex.com/share/x1xh4ejci]http://gavitex.com/share/x1xh4ejci
Again you can see how I manually organised them into relevant folders based on names and series. Mylar actually does that now so I am happy with what Mylar will do when it starts working.
This is the main download folder that all the folders are downloaded into. It is from here that the code sorts, organises and moves the relevant files. The permission on all these folders is 0777so the code has no restrictions.http://gavitex.com/share/8xywupzrv
The downloads folder that needs sorting http://gavitex.com/share/5uhgyll7o
This is how the movies sub folder should look if it is properly sorted: http://gavitex.com/share/bcfgc4umu
I will not be passing any parameters to the code because all the folders are fixed in location and are part of a pool.
In summary, the way I will run it is this. In sabnzbd, I will point to this code. I will also run it as a cron job - daily.
The code will go to the download folder (there is only one) and will sort through all the sub folders. Identify which of the downloads is a movie, tv show or music. It will then go through each folder and say for a movie, move the following files to the relevant folder in the movie section after it has created a sub folder for it : .mkv, .srt and .nfo. After moving hese specific files, it will move the balance of the sub folder it has just sorted and moved to the recycle bin i.e. it deletes the rest of the files it does not see as required. It does the same for music. Music files end in .mp3 or .vog.
Same for Tv shows. The peculiarity with TV shows is this. TV-HD shows have a 1080p in the description and are saved in the TV-HD sub folder. It should just move them as appropriate i.e. files in the TV-Shows/TV-HD in the download area are moved to the appropriate sub folders in the TV-HD sub folder.
Did I make this clear or have I just confused the whole issue?
Do you want to log into my system to see it?
The log issue was my error. There should be only one log - this one: /home/sabnzbd/.sabnzbd/logs/sab_proc.log
Oh finally - I did look through the code. I modified the TV section as best as I could. The movies section was just out of my competence. Also the repetition of the log was annoying. I thought it should have been a function but I can't look a gift horse in the mouth. The provider has done his/her best. I should move on with my changes but I can't as I haven't got the skills.
Thank you for even looking.