in reply to Beginner question regarding file lists/output

If you're in a *ixish world, why not just ls *index.ccr > indexlist.ccr?

In the Windows world, I think substituting dir for ls, with some appropriate options, may work.

If you're trying to do this from within a Perl program, I'd try something like

#perl -w use strict; use diagnostics; use File::Glob qw(:globally :nocase); my $log = 'indexlist.ccr'; open(LOG, $log) or die "Could not open $log because $!\n"; my @list = <*index.ccr>; print LOG join("\n", @list) . "\n"; close(LOG);

If you're running Windows, you'd probably want to use File::DosGlob;, with appropriate adjustments, instead.

emc

Netlib

Replies are listed 'Best First'.
Re^2: Beginner question regarding file lists/output
by psychotic (Beadle) on Dec 05, 2005 at 23:23 UTC
    In the Windows shell, this would achieve the desired:

    dir *index.ccr > indexlist.ccr

    Or you could use pipes, and filter dir through find and then output to the file, like so:

    dir | find "index.ccr" > indexlist.ccr

    Chaining commands using pipes allows the Windows shell, even though severy crippled when compared with *nix shells, to perform moderatelly complex administrative tasks.