msvisual.com Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

FileSystemObject

 
Post new topic   Reply to topic    msvisual.com Forum Index -> VB Enterprise
Author Message
boaz



Joined: 04 Oct 2007
Posts: 259

PostPosted: Tue Aug 08, 2006 5:38 pm    Post subject: FileSystemObject Reply with quote

For standalone VB6 program, do I use the FileSystemObject to access the
files? or FSO is only for ASP?


--
> There is no answer.
> There has not been an answer.
> There will not be an answer.
> That IS the answer!
> And I am screwed.
> Deadline was due yesterday.
>
> There is no point to life.
> THAT IS THE POINT.
> And we are screwed.
> We will run out of oil soon.

http://spaces.msn.com/bzDaCat

Archived from group: microsoft>public>vb>enterprise
Back to top
View user's profile Send private message
Ken Halter



Joined: 04 Oct 2007
Posts: 4150

PostPosted: Tue Aug 08, 2006 6:03 pm    Post subject: Re: FileSystemObject Reply with quote

"boaz" wrote in message
news:%23jMj3ryuGHA.324@TK2MSFTNGP06.phx.gbl...
> For standalone VB6 program, do I use the FileSystemObject to access the
> files? or FSO is only for ASP?

FSO was designed for use in scripting languages. It "works" in VB6 but it's
not required. VB has basically the same file I/O functions as the earliest
forms of BASIC.... with the added benefit of speed and reliability. What do
you want to do with which kinds of files? Posting more details usually means
a better answer to your specific problem/chore/task.


--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
In Loving Memory - http://www.vbsight.com/Remembrance.htm
Back to top
View user's profile Send private message
boaz



Joined: 04 Oct 2007
Posts: 259

PostPosted: Tue Aug 08, 2006 8:28 pm    Post subject: Re: FileSystemObject Reply with quote

"Ken Halter" wrote in message @TK2MSFTNGP03.phx.gbl...
> "boaz" wrote in message
> news:%23jMj3ryuGHA.324@TK2MSFTNGP06.phx.gbl...
>> For standalone VB6 program, do I use the FileSystemObject to access the
>> files? or FSO is only for ASP?
>
> FSO was designed for use in scripting languages. It "works" in VB6 but
> it's not required. VB has basically the same file I/O functions as the
> earliest forms of BASIC.... with the added benefit of speed and
> reliability. What do you want to do with which kinds of files? Posting
> more details usually means a better answer to your specific
> problem/chore/task.
>
>
> --
> Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
> DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
> In Loving Memory - http://www.vbsight.com/Remembrance.htm
>


I need to monitor the ftp root folder. I need to get the list of files
uploaded to the ftp and store the files and the attributes to a database. I
need to do this daily.

I don't remember how to do this anymore. The last thing I remember is to
use "Dir()" to see if a file is there in a folder.
So, a search give me a bunch of stuffs about the FileSystemObject.
Back to top
View user's profile Send private message
Ken Halter



Joined: 04 Oct 2007
Posts: 4150

PostPosted: Wed Aug 09, 2006 12:17 pm    Post subject: Re: FileSystemObject Reply with quote

"boaz" wrote in message @TK2MSFTNGP03.phx.gbl...
>
>
> I need to monitor the ftp root folder. I need to get the list of files
> uploaded to the ftp and store the files and the attributes to a database.
> I need to do this daily.
>
> I don't remember how to do this anymore. The last thing I remember is to
> use "Dir()" to see if a file is there in a folder.
> So, a search give me a bunch of stuffs about the FileSystemObject.

There are a bunch of goodies here.
http://vbnet.mvps.org/index.html?code/fileapi/

If you'll never distribute the app and don't mind sluggish performance, you
can use the FSO if you're comfortable with it. If this task only has to run
once a day, the FSO may be all you need.

--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
In Loving Memory - http://www.vbsight.com/Remembrance.htm
Back to top
View user's profile Send private message
boaz



Joined: 04 Oct 2007
Posts: 259

PostPosted: Wed Aug 09, 2006 2:16 pm    Post subject: Re: FileSystemObject Reply with quote

"Ken Halter" wrote in message @TK2MSFTNGP03.phx.gbl...
> "boaz" wrote in message
> @TK2MSFTNGP03.phx.gbl...
>>
>>
>> I need to monitor the ftp root folder. I need to get the list of files
>> uploaded to the ftp and store the files and the attributes to a database.
>> I need to do this daily.
>>
>> I don't remember how to do this anymore. The last thing I remember is to
>> use "Dir()" to see if a file is there in a folder.
>> So, a search give me a bunch of stuffs about the FileSystemObject.
>
> There are a bunch of goodies here.
> http://vbnet.mvps.org/index.html?code/fileapi/
>
> If you'll never distribute the app and don't mind sluggish performance,
> you can use the FSO if you're comfortable with it. If this task only has
> to run once a day, the FSO may be all you need.
>
> --
> Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
> DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
> In Loving Memory - http://www.vbsight.com/Remembrance.htm
>

ok... so for vb6, I need to use the win api to do file stuffs.
Using the FileSystemObject seems to be easier than calling API.
Back to top
View user's profile Send private message
Paul Clement



Joined: 04 Oct 2007
Posts: 1560

PostPosted: Thu Aug 10, 2006 12:39 pm    Post subject: Re: FileSystemObject Reply with quote

On Wed, 9 Aug 2006 10:16:40 -0700, "boaz" wrote:

¤ >> I need to monitor the ftp root folder. I need to get the list of files
¤ >> uploaded to the ftp and store the files and the attributes to a database.
¤ >> I need to do this daily.
¤ >>
¤ >> I don't remember how to do this anymore. The last thing I remember is to
¤ >> use "Dir()" to see if a file is there in a folder.
¤ >> So, a search give me a bunch of stuffs about the FileSystemObject.
¤ >
¤ > There are a bunch of goodies here.
¤ > http://vbnet.mvps.org/index.html?code/fileapi/
¤ >
¤ > If you'll never distribute the app and don't mind sluggish performance,
¤ > you can use the FSO if you're comfortable with it. If this task only has
¤ > to run once a day, the FSO may be all you need.
¤ >
¤ > --
¤ > Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
¤ > DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
¤ > In Loving Memory - http://www.vbsight.com/Remembrance.htm
¤ >
¤
¤ ok... so for vb6, I need to use the win api to do file stuffs.
¤ Using the FileSystemObject seems to be easier than calling API.


Yes it is, which is why a lot of people use it, and in this instance I probably would.

If you're running your app on newer versions of the OS, distribution of the component won't be
required. But keep in mind that there are different versions of the Windows Scripting object.

Otherwise Ken raises some good points for using VB and API functions.


Paul
~~~~
Microsoft MVP (Visual Basic)
Back to top
View user's profile Send private message
Garry



Joined: 04 Oct 2007
Posts: 31

PostPosted: Thu Sep 14, 2006 9:05 pm    Post subject: Re: FileSystemObject Reply with quote

If I rememebr correctly, the FSO made a 'Malicious script detected' suddenly
appear on one of my machines and the code was for a standalone but widely
sold application.

I used code such as

Private Function CopyTextFileToExistingTextFile(strSourceFile As String,
strTargetFile As String, boolOpen As Boolean) As Boolean

Dim strLine As String

If boolOpen Then
Open strTargetFile For Append As #1
End If

Open strSourceFile For Input As #2

Line Input #2, strLine
Do While Not EOF(2)
Print #1, Tab(0); strLine
strLine = ""
Line Input #2, strLine
Loop

End Function


to append one text to an already existing file and solved the problem.

The FSO can give you answers in 'object orientated tongue' to various file
property values but there are also various VB6 functions available to do
this. (GetAttr() and SetAttr() etc).

Sadly, the MSDN for VB6 was never completed by Microsoft and is very very
very very disorganised. Finding well documented examples to construct code
as the example above demonstrates is not easy

I, for the above reasons, stay clear of the FSO in my distributed apps.

Garry




"Paul Clement" wrote in message @4ax.com...
> On Wed, 9 Aug 2006 10:16:40 -0700, "boaz" wrote:
>
> ¤ >> I need to monitor the ftp root folder. I need to get the list of
> files
> ¤ >> uploaded to the ftp and store the files and the attributes to a
> database.
> ¤ >> I need to do this daily.
> ¤ >>
> ¤ >> I don't remember how to do this anymore. The last thing I remember
> is to
> ¤ >> use "Dir()" to see if a file is there in a folder.
> ¤ >> So, a search give me a bunch of stuffs about the FileSystemObject.
> ¤ >
> ¤ > There are a bunch of goodies here.
> ¤ > http://vbnet.mvps.org/index.html?code/fileapi/
> ¤ >
> ¤ > If you'll never distribute the app and don't mind sluggish
> performance,
> ¤ > you can use the FSO if you're comfortable with it. If this task only
> has
> ¤ > to run once a day, the FSO may be all you need.
> ¤ >
> ¤ > --
> ¤ > Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
> ¤ > DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
> ¤ > In Loving Memory - http://www.vbsight.com/Remembrance.htm
> ¤ >
> ¤
> ¤ ok... so for vb6, I need to use the win api to do file stuffs.
> ¤ Using the FileSystemObject seems to be easier than calling API.
>
>
> Yes it is, which is why a lot of people use it, and in this instance I
> probably would.
>
> If you're running your app on newer versions of the OS, distribution of
> the component won't be
> required. But keep in mind that there are different versions of the
> Windows Scripting object.
>
> Otherwise Ken raises some good points for using VB and API functions.
>
>
> Paul
> ~~~~
> Microsoft MVP (Visual Basic)

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    msvisual.com Forum Index -> VB Enterprise All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group