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.
Loading
Giwa AbdulhakeemPosted Oct 23, 2011, 8:48 PM
Javeed M ShaikhPosted Oct 18, 2011, 6:33 PM
you can use powershell script to move the files in the repective folders according to the days and then run this script from C# code or put it in the schedular.
example for 1 wk old files:
get-childitem -Path "C:\folder1\folder2" |
where-object {$_.LastWriteTime -lt (get-date).AddDays(-7)} |
move-item -destination "C:\folder1\1wkfolder"
based on the above example you can change the days parameter and have 2 wk, 3wk and 4 wk.
Next you can generate a datatable/objects/list and calculate the number of files based on types by using this example:
FileInfo[] FileList = Dir.GetFiles("*.docx", SearchOption.TopDirectoryOnly );
than you can bind the datable to the grid with appropriate folder links to the numbers, you can store these as well in the datatable.
Please do not forget to mark "Accepted Answer".