Computing.Net > Forums > Windows XP > Delete one file from folder and subfolders

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Delete one file from folder and subfolders

Reply to Message Icon

Name: ToweringInferno
Date: August 11, 2009 at 07:30:13 Pacific
OS: Windows XP
Subcategory: General
Comment:

I am trying to remove one file that keeps on popping up (creating itself) on a share through Vb.

This is what I have:

Dim fso, EpicIcon
Dim folder, folderCollection, subFolder, fileCollection

EpicIcon = "Epic.lnk"
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder("R:\")
Set folderCollection = folder.SubFolders
Set fileCollection = folder.Files
For Each File In fileCollection
fso.Delete (EpicIcon), True
Next

not really working...



Sponsored Link
Ads by Google

Response Number 1
Name: Joyfax Server
Date: August 11, 2009 at 07:49:04 Pacific
Reply:

For Each File In fileCollection
fso.Delete File, True
Next


0

Response Number 2
Name: ToweringInferno
Date: August 11, 2009 at 07:53:16 Pacific
Reply:

I changed the script a little:

Dim fso, EpicIcon
Dim folder, folderCollection, subFolder, fileCollection


Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder("R:\")
Set folderCollection = folder.SubFolders
For Each Folder In folderCollection
Set fileCollection = folder.Files
For Each File In fileCollection
EpicIcon = folder & "\Desktop\Epic.lnk"
fso.DeleteFile (EpicIcon), True
Next
Next


0

Response Number 3
Name: aegis1
Date: August 11, 2009 at 11:32:35 Pacific
Reply:

There is a 'Programming' forum.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: Delete one file from folder and subfolders

Cannot Delete Temporary files from www.computing.net/answers/windows-xp/cannot-delete-temporary-files-from-/161607.html

can't delete a file in xp www.computing.net/answers/windows-xp/cant-delete-a-file-in-xp/20946.html

folders and files are gone. www.computing.net/answers/windows-xp/folders-and-files-are-gone/115844.html