#!/usr/bin/perl -w
use strict;
$\="\n";
my $start=$ARGV[0] || die "no start point, use ./${0} path/to/dirrectory file-to-save.txt. example - ./${0} . files.txt";
$ARGV[1] || die "no target file";
open (FH,">>$ARGV[1]");
&reqFiles($start);
sub reqFiles
{
my $startPoint=shift;
opendir(DIR, $startPoint);
my @files=grep(!/^\.+$/,readdir(DIR));
map{-d($_) ? &reqFiles($_) : print FH "$_"}@files;
}
closedir(DIR);
close FH;