ASP.NET C#中的文件管理 [英] File Management in ASP.NET C#

查看:61
本文介绍了ASP.NET C#中的文件管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试为文件管理界面创建新的维度.我想要一种情况,其中旧文件是1wk,应该放在一个文件夹中,同一文件夹中的2wk是旧的,另一个文件夹中是3,而大于4weeks ..这正是我在datagridview中的意思.

* .Docx * .Pdf * .txt * .xls * .jpeg

< 1周3

2周5

3周1

> 4周2


注意:数字代表存在的文件(docx,pdf,txt,xls)的数量以及它们的年龄.

因此,单击数字,用户将获得所有文件的详细信息以及其他文件的详细信息.非常感谢您提供任何帮助.

在此先感谢.

Trying to make a new dimension to file management interface. I want a situation where files that''s are 1wk old should be in a folder, same goes with 2wk old in a different folder same goes with 3 while greater than 4weeks in another folder .. This is exactly what i mean in a datagridview.

*.Docx *.Pdf *.txt *.xls *.jpeg

< 1Week 3

2Week 5

3Week 1

> 4Week 2


NB: The numbers represent number of files(docx,pdf,txt,xls) that are present and how old they are.

So clicking on the numbers the user gets the details of all the files and other file details. Would really appreciate any help on this.

Thanks in advance.

推荐答案

我认为fileinfo属性有一个限制,在该限制中,您只能获取创建日期,但我会这样做:

使用DirectoryInfo遍历文件夹中的FileInfos,检查属性
使用创建/修改日期将其与当前系统日期进行比较.
使用扩展属性可以管理扩展列表,以便在需要新扩展时增加记录或增加计数.

如果您打算根据文件的使用期限来回移动文件,则需要进行很多工作.我会在yaer中将第9周的年(201109)中的每个星期都有文件夹,然后将文件移动到该文件夹​​中,而无需再次移动它们.从当前日期开始的年龄是一个不断变化的目标.
I think there is a limitation with the fileinfo attributes where you can only get the creation date however I would:

Use DirectoryInfo to loop through the FileInfos in a folder checking the attributes
Use create/modified date comparing it to the current system date.
Use the extension property to manage the extension list adding a record to your collection when a new extension is needed or incrementing the count.

If you intend to move the files around according to their age you are in for a LOT of work. I would have folders for each week in the year (201109) for the 9th week in the yaer and move the files into that folder NEVER having to move them again. Age from the current date is a moving target.


这篇关于ASP.NET C#中的文件管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆