in

Using perl script find file count with multiple pattern


I want to search files count inside a directory using PERL script.

If number of files in folder less than or equal to 5 list the file names with count,
else files not found in directory like “zero files found”.

Ex: Files inside directory like

testfile1d_01012022.txt
testfile2d_01012022.txt
testfile4d_01012022.txt
testfile9d_01012022.txt
testfile7d_01012022.txt

based on above file names, I given search pattern $Filename = “testfiled“.

But final result getting like below

testfiled_01012022.txt
testfiled_01012022.txt
testfiled_01012022.txt
testfiled_01012022.txt
testfiled_01012022.txt -its removed number after google d

below variables used in script.
my @files = grep!/^..?$/, readdir DIR
$Filename =~ s/*//g;

Let me know how to show available files with count.



Source: https://stackoverflow.com/questions/70543662/using-perl-script-find-file-count-with-multiple-pattern

700,000 lines of code, 20 years, and one developer: How Dwarf Fortress is built

Create a Google Search clone with React.js