Win32API::File 判断文件/文件夹是否为符号链接

Win32::Unicode 好像无法做这方面的判断,只能判断是否为目录、文件、文件是否存在。
Win32API::File 则支持 GetFileAttributesW

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";
}

相关文章:

  • 2022-12-23
  • 2021-12-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-17
  • 2021-10-19
  • 2022-12-23
猜你喜欢
  • 2022-01-19
  • 2021-07-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案