|
-
Mar 28th, 2009, 11:47 AM
#1
Thread Starter
Lively Member
[RESOLVED] Delete a certian file format in a folder.
Last edited by G3rmanpride21; Jan 28th, 2016 at 06:01 PM.
-
Mar 28th, 2009, 11:57 AM
#2
Re: Delete a certian file format in a folder.
That's very possible. I don't know the exact code but you use something like For Each ffile as File in Directory.GetAllFiles and then an if statement for each file to see if the end has the same extension as dem1, then you use .Kill to delete it. Someone will probably post some code for you.
-
Mar 28th, 2009, 11:57 AM
#3
Thread Starter
Lively Member
Re: Delete a certian file format in a folder.
Last edited by G3rmanpride21; Jan 28th, 2016 at 06:01 PM.
-
Mar 28th, 2009, 12:28 PM
#4
Re: Delete a certian file format in a folder.
Try this
Code:
Dim Dir As String = "C:\Directory"
Dim fileList As New List(Of String)
fileList.AddRange(My.Computer.FileSystem.GetFiles(Dir))
For x As Integer = 0 To fileList.Count - 1
Dim theFile As String = fileList.Item(x)
If My.Computer.FileSystem.GetFileInfo(theFile).Extension = ".dem1" Then
My.Computer.FileSystem.DeleteFile(Dir & "\" & theFile)
End If
Next
-
Mar 28th, 2009, 12:58 PM
#5
Thread Starter
Lively Member
Re: Delete a certian file format in a folder.
Last edited by G3rmanpride21; Jan 28th, 2016 at 06:02 PM.
-
Mar 28th, 2009, 01:16 PM
#6
Re: Delete a certian file format in a folder.
Sorry, take out Dir & "\" &.
Code:
Dim Dir As String = "C:\Directory"
Dim fileList As New List(Of String)
fileList.AddRange(My.Computer.FileSystem.GetFiles(Dir))
For x As Integer = 0 To fileList.Count - 1
Dim theFile As String = fileList.Item(x)
If My.Computer.FileSystem.GetFileInfo(theFile).Extension = ".dem1" Then
My.Computer.FileSystem.DeleteFile(theFile)
End If
Next
-
Mar 28th, 2009, 01:21 PM
#7
Thread Starter
Lively Member
Re: [RESOLVED] Delete a certian file format in a folder.
Last edited by G3rmanpride21; Jan 28th, 2016 at 06:02 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|