Monday, February 20, 2012

Old FSO snippet of code

Hi everyone,

Does anyone has ever written VbScript .Net stuff which do anything like that? I've got a dtsx package and I'd need covering along folder looking for subfolders and so on

objFSO = CreateObject("Scripting.FileSystemObject")

objFolder = objFSO.GetFolder("c:\test")

colSubfolders = objFolder.Subfolders

For Each objsubfolder In colSubfolders

...

...

Thanks in advance and best regards,

System.IO.FileSystemInfo is what you need

http://msdn2.microsoft.com/en-us/library/system.io.filesysteminfo.aspx

-Jamie

|||The .NET Version of this would be.

Dim Directories As String() = System.IO.Directory.GetDirectories("C:\test")
Dim I As Int32
For i = 0 To Directories.Length - 1
Dim TmpInfo As New System.IO.DirectoryInfo(Directories(i))
TmpInfo.Delete(...
Next

Links embedded in code go to documentation for related classes. Please see them and look at the "methods" list for a complete list of method's available to you.
Hope this helps,.|||Tons of thanks Jamie and MarcD.

No comments:

Post a Comment