NAME
Win32::Unicode::Dir.pm - Unicode string directory utility.
SYNOPSIS
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;
DESCRIPTION
Win32::Unicode::Dir is Unicode string directory utility.
METHODS
- new
-
my $wdir = Win32::Unicode::Dir->new;
- open($dir)
-
Like opendir.
$wdir->open($dir) or dieW $wdir->error;
- fetch()
-
Like readdir.
while (my $file = $wdir->fetch) { # hogehoge }
or
for my $file ($wdir->fetch) { $ hogehoge }
read
andreaddir
is alias of fetch. - close()
-
Like closedir.
$wdir->close or dieW $wdir->error
- error()
-
get error message.
FUNCTIONS
- getcwdW
-
Like Cwd::getcwd.
my $cwd = getcwdW;
- chdirW($dir)
-
Like chdir.
chdirW($dir) or dieW errroW;
- mkdirW($new_dir)
-
Like mkdir.
mkdirW($new_dir) or dieW errorW;
- rmdirW($del_dir)
-
Like rmdir.
rmdirW($del_dir) or dieW errorW;
- rmtreeW($del_dir)
-
Like File::Path::rmtree.
rmtreeW($del_dir) or dieW errorW;
- mkpathW($make_long_dir_name)
-
Like File::Path::mkpath.
mkpathW($make_long_dir_name) or dieW errorW
- cptreeW($from, $to [, $over])
-
copy directory tree.
cptreeW $from, $to or dieW errorW;
- mvtreeW($from, $to [, $over]))
-
move directory tree.
mvtreeW $from, $to or dieW errorW;
- findW($code, $dir)
-
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;
- finddepthW($code, $dir)
-
like File::Find::finddepth.
- dir_size($dir)
-
get directory size. this function are slow.
my $dir_size = dir_size($dir) or dieW errorW
AUTHOR
Yuji Shimada <xaicron@cpan.org>
SEE ALSO
Win32 Win32::API Win32API::File Win32::Unicode Win32::Unicode::File Win32::Unicode::Encode Win32::Unicode::Error
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.