groups

name language licence
Rename a lot of files in a directory 1 Perl Other
For the start of a PERL file Perl Other
List of files in a directory Perl Other
Untitled Snippet
Write data to a file Perl Other
Make a file containing a list of files in a directory Perl Other
Untitled Snippet Other Other

< 1 2 >



language: Perl
licence: Other

Make a file containing a list of files in a directory

options: view full snippetsend to code collector
#!/usr/bin/perl -w 

opendir(DIR, "output/");
@files = grep(/\.root$/,readdir(DIR));
closedir(DIR);

open (D2O,  '>output/file_list_d2o.dat');
open (SALT, '>output/file_list_salt.dat');
open (NCD,  '>output/file_list_ncd.dat');
foreach $file (@files) {
  $output = $file."\n";
  $phase = substr($file, 0, 1);
  if ( $phase eq "d" ) { print D2O  $output; }
  if ( $phase eq "s" ) { print SALT $output; }
  if ( $phase eq "n" ) { print NCD  $output; }
	
(Continues...)