Saturday, November 20, 2010

Perl: get hidden files

I was working on linux, it was a script that used to move and extract some files. Some of the files were hidden files(started with a dot(.))

If you use glob() function from Perl, it will not return those files. You have to relay on other functions. Like below one.

use File::Glob qw( bsd_glob );
my @files = ( bsd_glob("$dir/.*"), bsd_glob("$dir/*") );

If you use this one, at array @files, you'll have your all hidden and non hidden files in it.

No comments:

Get function name programaticaly - Python

This little piece of code will help you to get the function name programatically. This is very helpful when you are implementing the debug...