groups

name language licence
Struts in tables Latex Other
Tabs to spaces Other Other
Untitled Snippet
Write data to a file Perl Other
Make a file containing a list of files in a directory Perl Other
Command line arguments C++ Other
Read data from a file C++ Other
History Shell Other

< 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 >



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