Kodi Community Forum

Full Version: Films into folders
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
My films rips are stored in one folder eg:

G:\Films\Film1.av1 film2.avi film3.mkv etc

Now that I am getting more in to the xbmc idea of things i want each film in its own folder, so i can have all the subtitles, custom fanart, .info file etc sitting with each film. eg:

G:\Films\Film1\Film1.avi
G:\Films\film2\film2.avi etc

I have got a few hundred movies, and i know that is a small amount to some people, but to create a folder for each on and type out the name, copy the files, recrape et is going to take me ages.

so, basically my question is, what is the quickest/easiest/best way to go about this?

Thanks in advance

p.s im using windows xp
You can make a script that creates a folder named as your movie files.
Example:
movie 1 file name: movie1.xvid.avi
folder 1 name created: movie1.xvid
movie 2 file name: movie2.avi
folder 2 name created: movie2

Code:
#!/bin/sh

for file in *         #Read every file in current folder
do
  name=${file%\.*}    #Remove file ending (.avi for example)
  mkdir \"$name\"       #Creates the folder
  mv \"$file\" \"$name/\"   #Move the files into that folder
done;

This will create a folder for each unique filename you have, file types not included.

If there's 4 files for example:
Movie.x264.1080p.Group.mkv
Movie.x264.1080p.Group.srt
Movie.x264.1080p.Group.nfo
Movie.jpg

There will be 2 folders:
Movie.x264.1080p.Group, containing 3 first files
Movie, containing the .jpg file

Edit: Sorry didn't see you were running Win XP
If you use "Ember Media Manager" it can sort your movies into folders for you just make sure you enable the following

In settings under movies > Files and Sources select "Sort files into folders before each library update"

If you use Ember to scrape make sure you also select "Scrape full cast" under movies > Scrapers Data otherwise your movie details will have lots of info missing as imdb changed their layout and this is a work around
thanks, ill give that a try
This batch script does the same but for win xp:
Code:
@echo off
FOR /f "delims=" %%? IN ('DIR /B /A:-D') DO MKDIR "%%~n?"
FOR /f "delims=" %%? IN ('DIR /B /A:-D') DO MOVE "%%?" "%%~n?"

Copy the code to a empty text document, save as something.bat.
Put the file in the folder you want and run it.