2004-02-29, 13:21
it copies the foldername.tbn to foldername/folder.jpg.
paste the code into an file, then chmod 755 filename. go to the dir where the tbn files are, call the script.
mayby not the best script but it works.
paste the code into an file, then chmod 755 filename. go to the dir where the tbn files are, call the script.
mayby not the best script but it works.
Quote:#!/usr/bin/perl
$dir = ".";
opendir(dir, "$dir");
my @files = readdir(dir);
for $i (@files)
{
if ($i =~ /.*\.tbn$/)
{
$filename = $i;
$dirname = $i;
$filename =~ s/.*\.tbn$/folder\.jpg/i;
$dirname =~ s/\.tbn$//i;
$l = "\"";
$filename = $filename.$l;
$dirname = $l.$dirname."/";
$dest = $dirname.$filename;
$i = $l.$i.$l;
print "$dest\n";
unless (-e $j)
{
`cp $i $dest`;
}
}
}