回答編集履歴
3
コードの修正
answer
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
```VB.NET
|
2
|
+
Dim cul = System.Globalization.CultureInfo.InvariantCulture
|
3
|
+
Dim fileday As String
|
4
|
+
fileday = Today.AddDays(-7).ToString(format:="yyyyMMdd", provider:=cul)
|
5
|
+
|
2
|
-
For Each ss As String In IO.Directory.GetFiles("C:\
|
6
|
+
For Each ss As String In IO.Directory.GetFiles("C:\DIR")
|
3
7
|
Dim fi As New IO.FileInfo(ss)
|
4
8
|
Dim ext As String = System.IO.File.GetCreationTime(ss).ToString("yyyyMMdd", cul)
|
5
9
|
If ext < fileday Then
|
6
10
|
ListBox1.Items.Add(ss)
|
7
|
-
IO.File.Delete(ss)
|
8
11
|
End If
|
9
12
|
Next
|
10
13
|
|
11
14
|
```
|
12
|
-
このようなコードを書いて実行してみたのですがファイルが
|
15
|
+
このようなコードを書いて実行してみたのですがファイルがリストボックスにされません。
|
2
詳細
answer
CHANGED
@@ -1,8 +1,12 @@
|
|
1
|
+
```VB.NET
|
2
|
+
For Each ss As String In IO.Directory.GetFiles("C:\Users\Koyama_Shogo\Desktop\DIR")
|
1
|
-
|
3
|
+
Dim fi As New IO.FileInfo(ss)
|
2
|
-
|
4
|
+
Dim ext As String = System.IO.File.GetCreationTime(ss).ToString("yyyyMMdd", cul)
|
5
|
+
If ext < fileday Then
|
6
|
+
ListBox1.Items.Add(ss)
|
7
|
+
IO.File.Delete(ss)
|
3
|
-
|
8
|
+
End If
|
4
|
-
http://bbs.wankuma.com/index.cgi?mode=al2&namber=85652
|
5
|
-
で質問をしたのですがファイルの削除がうまくいきませんでした。
|
6
|
-
|
9
|
+
Next
|
10
|
+
|
7
|
-
|
11
|
+
```
|
8
|
-
こ
|
12
|
+
このようなコードを書いて実行してみたのですがファイルが削除されません。
|
1
answer
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
すみません気を付けたいと思います。
|
1
2
|
指定したファイルの削除(http://bbs.wankuma.com/index.cgi?mode=al2&namber=85674)
|
2
3
|
は違います。
|
3
4
|
http://bbs.wankuma.com/index.cgi?mode=al2&namber=85652
|