Win32::FindFile - simple unicode directory reader under Win32
use Win32::FindFile; use bytes; my @txt_files = FindFile( "*.txt" ); my @dir_content = ReadDir( "." ); # and finally # print entire directory content in unicode # for ( @dir_content ){ next unless $file->is_entry # skip over '.', '..' next if $file->is_hidden; # skip over hidden files next if $file->is_system; # etc next if $file->ftCreationTime > time -10; # skip over files created recently next if $file->ftLastWriteTime > time -10; next if $file->ftLastAccessTime > time -10; next if $file->FileSize == 0; # print $file->relName( "$dirname" ), "\n" ; # same as "dirname/$file" (Unix style) print $file->relName( "$dirname", "\\" ), "\n" ; # same as "dirname\\$file" (Win style) print $file, "\n"; # $file->cFileName print $file->dosName, "\n"; my $s = $file->dwFileAttributes; # Get all attribytes }; print "Current directory is ", GetCurrentDirectory(), "\n";
Win32::FindFile are simple tool for reading unicode dir content. It call kernel32.dll unicode functions FindFirstFileW, FindNextFileW, and covert UTF-16 to utf8 and back there is needed. Main Function is FindFile that take pattern of form '*' or '$directory\*' or more complex "$directory\*.txt" and return records from FileFileNextW as Class. Other function are utility functions as Copy, Move, GetCurrentDirectory, SetCurrentDirectory, ... etc.
FindFile
FindFile( $GlobPattern ); @file_matches = FindFile( "$Dir\*" ) or "warn not files match"; @file_matches = FindFile( "*" ) ; # list current directory; @file_matches = FindFile( "A*") ; # list files beginning with A letter
GetCurrentDirectory
$curpwd = CurrentDirectory();
SetCurrentDirectory
SetCurrentDirectory( $next_curpwd ); # set current directory
GetFullPathName
$absolute_path = GetFullPathName( $filename ) Expand file name to absolute path
Win32, Win32API, Win32::UNICODE, Win32::LongPath
A. G. Grishaev, <grian@cpan.org>
Copyright (C) 2014 by A. G. Grishaev
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available.
1 POD Error
The following errors were encountered while parsing the POD:
=over should be: '=over' or '=over positive_number'
To install Win32::FindFile, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Win32::FindFile
CPAN shell
perl -MCPAN -e shell install Win32::FindFile
For more information on module installation, please visit the detailed CPAN module installation guide.