急问:如何读取一个文件大小属性??

wjhcjg 2004-08-09 02:44:43
我要在已知的一个表中(表中记录能找到对应的文件名及路径)找出对应的文件名,把不符合指定大小的文件要求的文件名记录找出来,我怎么去读取一个文件的大小属性?没有组件上传的文件.可以读出其大小吗?谢谢!~
...全文
123 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
呵呵,上面写的是文件属性我就不写了
读取出文件名在寻找,不过我觉的好象需要交互的,挺慢
xiaoxingchi 2004-08-09
  • 打赏
  • 举报
回复
<%
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set Files = FSO.GetFile("c:\HONDA.jpg")
%>
<font color=red>[<%=Files.Name%>]</font>文件的全部属性:
<Br>名称:<%=Files.Name %>
<Br>路径:<%=Files.Path %>
<Br>驱动器:<%=Files.Drive %>
<Br>大小:<%=Files.size %>
<Br>类型:<%=Files.type %>
<Br>属性:<%=Files.Attributes %>
<Br>创建日期:<%=Files.DateCreated %>
<Br>上次进入日期:<%=Files.DateLastAccessed %>
<Br>上次修改日期:<%=Files.DateLastModified %>
<br>文件的父文件夹:<%=Files.ParentFolder%>
<br>文件短文件名:<%=Files.ShortName%>
<br>短路径名:<%=Files.ShortPath%>
mjpclab 2004-08-09
  • 打赏
  • 举报
回复
set fso=server.createobject("scripting.filesystemobject")
get ofile=fso.getfile(server.mappath("111.txt"))

response.write "大小" & ofile.size & "<br>"

if cint(ofile.Attributes and 1)<>0 then response.write "只读,"
if cint(ofile.Attributes and 2)<>0 then response.write "隐含,"
if cint(ofile.Attributes and 4)<>0 then response.write "系统,"
if cint(ofile.Attributes and 16)<>0 then response.write "目录,"
if cint(ofile.Attributes and 32)<>0 then response.write "存档,"
xiaobird1 2004-08-09
  • 打赏
  • 举报
回复
Set Myfile=MyFileObject.GetFile(“c:\test.txt”)
%>

<Br>名称:<%=Myfile.Name %>
<Br>路径:<%=Myfile.Path %>
<Br>驱动器:<%=Myfile.Drive %>
<Br>大小:<%=Myfile.size %>
<Br>类型:<%=Myfile.type %>
<Br>属性:<%=Myfile.Attributes %>
<Br>创建日期:<%=Myfile.DateCreated %>
<Br>上次进入日期:<%=Myfile.LastAccessed %>
<Br>上次修改日期:<%=Myfile.LassModified %>

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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