PDA

View Full Version : perl script to copy your xbmp *.tbn to folder.jpg


hederuiter
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.

#!/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`;
* *}
*}
}