Photo Gallery
Member List
Search
Calendars
FAQ
Ticket List
Log Out
Forums
Register
Login
My Profile
Inbox
Address Book
My Subscription
My Forums
Read Specific types of Files in a folder
Logged in as: Guest
arrSession:exec spGetSession 2,2,50321
Active Users: There are
0
members and
0
guests.
Users viewing this topic: none
Printable Version
All Forums
>>
[Scripting]
>>
WSH & Client Side VBScript
>> Read Specific types of Files in a folder
Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page:
[1]
Login
Message
<< Older Topic
Newer Topic >>
Read Specific types of Files in a folder -
8/2/2007 6:52:22 PM
peachtea
Posts: 41
Score: 0
Joined: 7/5/2007
From: Singapore
Status:
offline
hi all
i know that the following allow me to read all files in a folder Set objFSO = WScript.CreateObject("Scripting.FileSystemObject") Const ForReading = 1 Set InputFile = objFSO.GetFolder("C:\Documents and Settings\Administrator\Desktop\Datascope\sample-data\")
but i need to read specific type of file
have found something like "Set InputFile = objFSO.GetFolder("C:\Documents and Settings\Administrator\Desktop\Datascope\sample-data\
*.o
")
which is suppose to delete all files with extension "o" and ignore the rest
but i got the error msg "File not found" but there is file there.... pls help! Thanks
Post #: 1
RE: Read Specific types of Files in a folder -
8/2/2007 8:38:56 PM
ginolard
Posts: 1082
Score: 21
Joined: 8/10/2005
Status:
offline
use the GetExtensionName method of FSO
Set objFSO = WScript.CreateObject("Scripting.FileSystemObject") For Each file In objFSO.GetFolder("C:\Documents and Settings\Administrator\Desktop\Datascope\sample-data\").Files If objFSO.GetExtensionName(file) = "o" Then 'do Stuff End If Next
_____________________________
Author of ManagePC -
http://managepc.net
AD Query Template -
http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework -
http://www.visualbasicscript.com/m_59109/tm.htm
(in reply to
peachtea
)
Post #: 2
If you found our site useful please link to us
<a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>
.
All Forums
>>
[Scripting]
>>
WSH & Client Side VBScript
>> Read Specific types of Files in a folder
Page:
[1]
Jump to:
Select a Forum
All Forums
----------------------
[Welcome]
- - Forum Rules
- - Test Posting Messages
- - New Member Area/Introduction
[Scripting]
- - WSH & Client Side VBScript
- - WSH & Client Side VBScript Tutorial
- - Post a VBScript
- - Windows PowerShell
- - ASP
- - ASP.NET
- - Windows Script Components
[General Forum]
- - Other Programming/Scripting Languages
- - Suggestions & Feedback
- - Off-Topic Lounge
New Messages
No New Messages
Hot Topic w/ New Messages
Hot Topic w/o New Messages
Locked w/ New Messages
Locked w/o New Messages
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
Forum Software ©
ASPPlayground.NET
Advanced Edition
2.5.5 ANSI