![]() |
![]() |
5 Einträge, 1 Seite |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
$komma = rand(9999999); $random = int($komma); if (!-d "search/1") { mkdir("search/1"); } $count = 0; foreach $file (@found) { $count++; } $foreach = 0; foreach $aa (@found) { $foreach++; $ordnercount = 0; foreach $ordner ("search/*") { $ordnercount++; } $dateicount = 0; foreach $datei ("search/$ordnercount/*.txt") { $dateicount++; } if ($dateicount =~ 5) { $ordnercount++; mkdir("search/$ordnercount"); open(DATA,'>',"search/$ordnercount/$random.txt")|| print "FEHLER $!"; print DATA "FILE"; close(DATA); } else { open(DATA,'>',"search/$ordnercount/$random.txt")|| print "FEHLER $!"; print DATA "FILE"; close(DATA); } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
#!/usr/bin/perl $komma = rand(9999999); $random = int($komma); foreach $file (glob("files/*.txt")) { push(@found,$file); } if (!-d "suche/1") { mkdir("suche/1"); } foreach $found (@found) { $dir = 0; foreach $a (glob("suche/*")) { $dir++; } $files = 0; foreach $b (glob("suche/$dir/*.txt")) { $files++; } if ($files =~ 5) { $dir++; mkdir("suche/$dir"); open(WRITE,'>',"suche/$dir/$random.txt") or die "Fehler $!"; print WRITE "TESTFILE"; close (WRITE); } else { open(WRITE,'>',"suche/$dir/$random.txt") or die "Fehler $!"; print WRITE "TESTFILE"; close (WRITE); } } print "Found : ","@found","\n"; print "Ordner : ","$dir","\n"; print "Datei : ","$files","\n";
my @found = glob "files/*.txt";
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#!/usr/bin/perl use strict; use warnings; my @files = glob "files/*.txt"; my $counter = 0; my $dir = 1; for my $file ( @files ){ if( $counter++ % 5 == 0 ){ $dir++; } mkdir "suche/$dir" unless -e "suche/$dir"; my $random = int rand 999999; open my $fh, '>', "suche/$dir/$random$file" or die $!; print $fh "DATEI"; close $fh; }
![]() |
![]() |
5 Einträge, 1 Seite |