Win32::Unicode::Dir.pm - Unicode string directory utility.
use Win32::Unicode::Console; use Win32::Unicode::Dir; my $dir = "I \x{2665} Perl"; my $wdir = Win32::Unicode::Dir->new; $wdir->open($dir) || die $wdir->error; for ($wdir->fetch) { next if /^\.{1,2}$/; my $full_path = "$dir/$_"; if (file_type('f', $full_path)) { # $_ is file } elsif (file_type('d', $full_path)) # $_ is directory } } $wdir->close || dieW $wdir->error; my $cwd = getcwdW(); chdirW($change_dir_name); mkdirW $dir; rmdirW $dir;
Win32::Unicode::Dir is Unicode string directory utility.
my $wdir = Win32::Unicode::Dir->new;
Like opendir.
$wdir->open($dir) or dieW $wdir->error;
Like readdir.
while (my $file = $wdir->fetch) { # hogehoge }
or
for my $file ($wdir->fetch) { $ hogehoge }
read and readdir is alias of fetch.
read
readdir
Like closedir.
$wdir->close or dieW $wdir->error
get error message.
Like Cwd::getcwd.
my $cwd = getcwdW;
Like chdir.
chdirW($dir) or dieW errroW;
Like mkdir.
mkdirW($new_dir) or dieW errorW;
Like rmdir.
rmdirW($del_dir) or dieW errorW;
Like File::Path::rmtree.
rmtreeW($del_dir) or dieW errorW;
Like File::Path::mkpath.
mkpathW($make_long_dir_name) or dieW errorW
copy directory tree.
cptreeW $from, $to or dieW errorW;
move directory tree.
mvtreeW $from, $to or dieW errorW;
like File::Find::find.
findW(sub { my $file = $_; my $full_path = $Win32::Unicode::Dir::name; my $cwd = $Win32::Unicode::Dir::cwd; }, $dir) or dieW errorW;
or findW(sub { my $arg = shift; printf "%s : %s : %s", $arg->{file}, $arg->{path}, $arg->{cwd}; }, $dir) or dieW errorW;
like File::Find::finddepth.
get directory size. this function are slow.
my $dir_size = dir_size($dir) or dieW errorW
Yuji Shimada <xaicron@cpan.org>
Win32 Win32::API Win32API::File Win32::Unicode Win32::Unicode::File Win32::Unicode::Encode Win32::Unicode::Error
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Win32::Unicode, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Win32::Unicode
CPAN shell
perl -MCPAN -e shell install Win32::Unicode
For more information on module installation, please visit the detailed CPAN module installation guide.