[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: [PROGRAMMERING] [PERL] Split fil/bibliotek og opret bib



Erlo Haugen wrote:
> Problemet er at jeg ikke lige kan finde en smart måde at bruge output
> fra dirname til at oprette biblioteksstrukturen!

use File::Path;
mkpath "elefant/ged/ost";

opretter automatisk katalogerne, således at du kan kopiere
xxx-yyy-zzz-ppp.txt til xxx/yyy/zzz/ppp.txt

Jeg ville noget i retning af (totalt uprøvet):

use File::Path;

foreach $n (listen af filer)    f.eks. "xxx-yyy-zzz-ppp.txt"
{
@f = split "-",$n;
$fil = pop @f;         # ppp.txt
$dir = join "/",@f;    # xxx/yyy/zzz

mkpath $dir;
system "mv $n $dir/$fil";
}

-- 
  Mvh. Carsten Svaneborg
http://www.softwarepatenter.dk


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:43 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] *