Flatten Subfolders

Come up with a useful post-processing script? Share it here!
Post Reply
SkillPhil
Newbie
Newbie
Posts: 1
Joined: August 17th, 2010, 7:08 am

Flatten Subfolders

Post by SkillPhil »

Hi guys

i'm using sabnzbd for a long time now on my Thecus NAS and everything works perfect.
The only thing i couldn't find is a very simple folder-rename shell script for Linux.

As i take care of all the meta data of my movies on my own, i'm just looking for a script wich
takes care of the files and folders:

I want a single folder for a download job. All files of subfolders should be cut and pasted to the root (flattening the folder structure).
This root folder should be named like the NZB file for the job. The empty subfolders can be deleted.

Example:

Lets pretend we have the main folder, a subfolder with the moviefile and another subfolder with subtitles.

/Movies/old.folder.name/old.file.name.nfo
/Movies/old.folder.name/old.subfolder.name/old.file.name.mkv
/Movies/old.folder.name/old.subfolder.name/subtitles/old.file.name.sub

After the script all files should be in the main folder:

/Movies/NZB Filesname/nbfilename.nfo
/Movies/NZB Filesname/nbfilename.mkv
/Movies/NZB Filesname/nbfilename.sub


The script should also work if there are no subfolders :-)

The files should have the NZB Name as well.

Does anyone know a script wich does something similar to this? Maybe as a staring point
so i can edit it to fit my needs...


Greetz

Phil
causalloop
Newbie
Newbie
Posts: 25
Joined: September 25th, 2012, 6:51 pm

Re: Flatten Subfolders

Post by causalloop »

Anyone come up with a good script for this?
Post Reply