C# 不显示隐藏文件

cshape_gis 2007-03-26 12:53:33
使用System.IO.Directory.GetDirectories 方法获取的是所有的子目录和文件,,现在我想过滤掉那些系统隐藏的文件该怎么做啊????
...全文
658 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
wxlcc520 2007-04-13
  • 打赏
  • 举报
回复
mark
xxelement 2007-03-26
  • 打赏
  • 举报
回复
ufoteam的方法可行
sz709 2007-03-26
  • 打赏
  • 举报
回复
学习..顶
liujiwe79 2007-03-26
  • 打赏
  • 举报
回复
用File.GetAttributes判断
ufoteam 2007-03-26
  • 打赏
  • 举报
回复
fi.Attributes & FileAttributes.Hidden ) != 0变为fi.Attributes & FileAttributes.Hidden ) == 0
ufoteam 2007-03-26
  • 打赏
  • 举报
回复
自己过滤
private string[] FilterOutoffHiddenFiles( string[] filenames)
{
string[] filenames1 = new string[filenames.Length];
int i =0;
foreach( string str in filenames )
{
FileInfo fi = new FileInfo(str);
if( (fi.Attributes & FileAttributes.Hidden ) != 0 )
{
filenames1[i++] = str;
}
}
return filenames1;
}
cshape_gis 2007-03-26
  • 打赏
  • 举报
回复
属性里面好像没有这个啊??
bitpolar 2007-03-26
  • 打赏
  • 举报
回复
判断属性

110,566

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧