473,699 Members | 3,360 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Capturing file attributes

JH
I am scanning selected drives and computers and capture all files and their
attributes. I am using the scripting file system object. It takes a long
time to collect the attributes. Is there a better and faster way of
capturing file attributes of all files in a selected drive or computer.

CreateObject("S cripting.FileSy stemObject")
Folder = fso.GetFolder(F name)
For Each File In Folder.Files

Thanks
Nov 20 '05 #1
5 1585
* "JH" <yh*******@yaho o.com> scripsit:
I am scanning selected drives and computers and capture all files and their
attributes. I am using the scripting file system object. It takes a long
time to collect the attributes. Is there a better and faster way of
capturing file attributes of all files in a selected drive or computer.


Did you already have a look at the 'System.IO' namespace (I am not sure
if this will give you a speed improvement, but it you will get rid of
the FSO component).

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
"JH" <yh*******@yaho o.com> schrieb
I am scanning selected drives and computers and capture all files and
their attributes. I am using the scripting file system object. It
takes a long time to collect the attributes. Is there a better and
faster way of capturing file attributes of all files in a selected
drive or computer.

CreateObject("S cripting.FileSy stemObject")
Folder = fso.GetFolder(F name)
For Each File In Folder.Files


Don't use the Filesystemobjec t. Use the functions built into the Framework:
- System.IO.File. GetAttributes
- System.IO.FileS ystemInfo.Attri butes
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3
Hi,

Imports System.IO

Module Module1

Sub Main()
Dim strFile As String

For Each strFile In Directory.GetFi les("C:\")
Dim fi As New FileInfo(strFil e)
Console.WriteLi ne(String.Forma t("{0} {1}", fi.Name,
fi.Attributes.T oString))
Next
End Sub

End Module

Ken
--------------------
"JH" <yh*******@yaho o.com> wrote in message
news:eA******** ******@TK2MSFTN GP09.phx.gbl...
I am scanning selected drives and computers and capture all files and their
attributes. I am using the scripting file system object. It takes a long
time to collect the attributes. Is there a better and faster way of
capturing file attributes of all files in a selected drive or computer.

CreateObject("S cripting.FileSy stemObject")
Folder = fso.GetFolder(F name)
For Each File In Folder.Files

Thanks

Nov 20 '05 #4
JH

thanks for the info. However, I need all the attributes: size, last
accessed, last modifed, etc...etc...

what do I have to include in the code....given by Ken

Thanks again
Nov 20 '05 #5
Hi,

Take a look at the fileinfo class

http://msdn.microsoft.com/library/de...mberstopic.asp

Imports System.IO

Module Module1

Sub Main()
Dim strFile As String

For Each strFile In Directory.GetFi les("C:\")
Dim fi As New FileInfo(strFil e)
Console.WriteLi ne(String.Forma t("{0} {1} {2} {3}", fi.Name,
fi.LastAccessTi me, fi.Length, fi.Attributes.T oString))
Next
End Sub

End Module

Ken
-----------------------
"JH" <yh*******@yaho o.com> wrote in message
news:uv******** ******@TK2MSFTN GP10.phx.gbl...

thanks for the info. However, I need all the attributes: size, last
accessed, last modifed, etc...etc...

what do I have to include in the code....given by Ken

Thanks again

Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

33
5613
by: Joerg Schuster | last post by:
Hello, Python regular expressions must not have more than 100 capturing groups. The source code responsible for this reads as follows: # XXX: <fl> get rid of this limitation! if p.pattern.groups > 100: raise AssertionError( "sorry, but this version only supports 100 named groups"
7
12248
by: John R. | last post by:
How do you set the following file attributes: Compressed Encrypted Normal ReparsePoint SparsePoint You CAN'T set these using FileInfo.Attributes or File.SetAttributes. It doesn't work for these file attributes.
7
13397
by: Mark | last post by:
Hello, I have researched and tried every thing I have found on the web, in groups and MS KB articles. Here is what I have. I have a Windows 2000 Domain Controller all service packs and every thing else from windows update. ..NET 1.0 and 1.1 installed on the server. Actually .NET was installed before the server was made a DC.
4
1418
by: Steve Wolfie | last post by:
Hello all: Again, let me thank everyone who has helped in the past. Can't wait till I can help out with some advice of my own. Now, I am building an app that wishes to retrieve the output of Google Desktop. It is very simple, I wish to send an http request asking for the results in XML. ( by adding &format=xml to the end of the url) i would like to capture the response from the Google Desktop server, (on the local machine) and save...
3
1127
by: PJ6 | last post by:
I'm apparently not understanding something. I want to capture some user events in a web control I'm inheriting from, such as a table cell or a button. The code below doesn't work, the attributes aren't even rendered. I'm sure I'm not calling the sub right, either. Can someone clue me in? Paul Protected Overrides Sub OnPreRender(ByVal e As System.EventArgs) Attributes.Add("onMouseOut", "TEST") Attributes.Add("onClick", "TEST")
10
6010
by: Andrew | last post by:
Hi, I have a messagebox that pops up due to an event. I did it in javascript. ie. alert("Time's up. Assessment Ended"); I want to capture the OK and Cancel events of this alert messagebox. My code is in C#/ASP.NET. TIA. Andrew.
1
3276
by: Christian Rühl | last post by:
hey! what i wanna do sounds very simple at first, but it turned out to be a real bone crusher... i want to check if a treeView node is checked and if a correspondent node in my xml config file exists just to sort of synchronize them by changing the xml nodes attribute(s). somehow i always catch an exception "blabla has an invalid token" but i cannot find a solution for this. maybe someone of you people can tell me how to do this...
2
2958
by: jallam | last post by:
Hi, I have a Python script to upload the Invoice data which is in .csv file to OTM (GLOG) system. I'm running this script using the command(given below) using a shell script and capturing the output to a file (which we are refering as a log). python TestInvoiceTransform.py -glUserGid <user> -glPassword <password> -inputFileName TestInvoice.csv -hostname <host url> -mailto <mail id> -smtphost amermsx.med.ge.com > test.log The output is...
0
8704
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8623
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9053
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8936
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8894
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6540
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5879
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2360
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.