Explore BrainMass

Explore BrainMass

    Find command in Perl

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Unix provides users with a find command that can be used to locate one or more files.

    find / -name filename -type f 2>errorlog.txt

    I was told that Perl has a good find command. How to use it? How the result will be displayed? Using the command I should be able to locate a single file or multiple files.

    I am looking for a solution where I can pass the parameters on the prompt itself whenever I need to search for some files, as shown in the examples below.

    Path_to_Perl Name_of_Perl_script Path_to_search_directory Filename1 Filename2 Filename3 ...

    /usr/bin/perl myfind.pl /tmp Thakur brown orange

    © BrainMass Inc. brainmass.com October 10, 2019, 12:25 am ad1c9bdddf

    Solution Preview

    Attached solution 291743.pl adheres to the given requirement and thus it should be given ...

    Solution Summary

    The solution makes use of Perl's File::Find module that should be installed on your system. Script arguments should be explicit file names (like hello.txt) and not patterns (like *.txt).