Win32API::File 判断文件/文件夹是否为符号连接php
Win32::Unicode 好像没法作这方面的判断,只能判断是否为目录、文件、文件是否存在。
Win32API::File 则支持 GetFileAttributesWcode
GetFileAttributes 的返回值常量列表,可参考 MSDN 官方文档:
https://msdn.microsoft.com/en-us/library/gg258117(v=vs.85).aspx
Code: [全选] [展开/收缩] [Download] (Untitled.pl)文档
use utf8; use Encode; use Win32API::File qw(:ALL); my $path = "D:\\Extra\\中文"; my $code = GetFileAttributesW( encode('utf16-le', $path) ."\x00\x00" ); if ( ($code & FILE_ATTRIBUTE_REPARSE_POINT) == FILE_ATTRIBUTE_REPARSE_POINT) { print "$code, symbolic link\n"; }