[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [NOVICE] bash-prog



KVL> Jeg skal bruge et lille script der kan rename en flok filer
KVL> med løbende nr. De må gere blive liggende i samme mappe,
KVL> men det er ok hvis ikke.
KVL> Er der nogen kan hjælpe mig med det??

Hej der,

Jeg ved ikke om denne slags problemer er passende paa denne liste
(tror der er en specific liste for det) - men her er et lille script
jeg brugte til at rename alle mine billeder (som laa i et dir der hed
"pic") - Jeg har tilfoejet et par kommentarer, saa du forhaabentligt
kan tilpasse scriptet til dit behov:

---
#!/usr/bin/perl

# set directoryname - and go there (clumsy, but it works)
$dirname="pic";
chdir($dirname);
opendir(D, ".");
@files=grep(-f, readdir(D));    # get a list of all files (no directories)
closedir(D);

print "Files are: @files\n";
# a little loop, where we keep adding one to the value
while($file = shift @files) {
   $new_file_num++;
   print "Rename $file to "Firmafest_$new_file_num.jpg\n";
#   rename $file, "Firmafest_$new_file_num.jpg";    # uncomment this line to really rename the files
}
---

LAeg maerke til at selve scriptet ligger en tak laengere ude end selve
filerne, det var den nemmeste lille workaround - da scriptet ellers
ville rename sig selv til  Firmafest_67.jpg ;)

Held og lykke!

Martin




 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 19:19 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *