Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In order to match the criteria of a "coverflow" like soft I have to create a specific folder (named "name_of_the_film") for each film.avi and cover.jpg I have in my film directory :

Today:

d:/film/starwars.avi, 
d:/film/starwars2.avi
d:/film/starwars.jpg
d::film/starwars2.jpg

Tomorrow:

d:/film/starwars
d:/film/starwars/starwars.avi
d:/film/starwars/starwars.jpg 
d:/film/starwars2
d:/film/starwars2/starwars2.avi
d:/film/starwars2/starwars2.jpg 

Is it possible to do this automatically?

share|improve this question
up vote 3 down vote accepted

I'm not aware of any apps which do this, but you can write a short Perl or Python script to do this for you. The following perl script should do what you need:

use File::Copy;

my $baseDir = "D:/film/";

opendir my $dir, $baseDir or die "Cannot open directory: $!";
my @files = readdir $dir;

foreach my $file (@files)
{
  $fileName = $1 if ($file =~ /^(.*)\.[^\.]+$/i);
  mkdir("$baseDir/$fileName") unless (-d "$baseDir/$fileName");
  move("$baseDir/$file", "$baseDir/$fileName/$file");
}

Assuming you have perl installed, save this script as CreateMovieFolders.pl and then run perl CreateMovieFolders.pl from the command-line.

share|improve this answer

You can do it with a batch script.

See here for a list of ways you can mangle for loop variables.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .