0

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?

2 Answers 2

3

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.

0

You can do it with a batch script.

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

You must log in to answer this question.

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