Oppure

Loading
25/04/10 12:23
Il Totem
Probabilmente a(1) non esiste, anche perchè nella cartella Programmi non esiste nessun programma, ma solo altre cartelle. Dovresti quindi estendere la ricerca ricorsivamente sulle sottocartelle:
msdn.microsoft.com/en-us/library/…
aaa
25/04/10 18:04
giogiogio1213
Grazie mille scusate se non ho messo l'errore ...

Mi dice "Va oltre il limite della matrice", pensavo che la ricerca nelle sotto-cartele fosse data per scontato, scusate potete dirmi gentilmente come effettuare la ricerca anche nelle sottocartelle di C:\Programmi\... ?

aaa
25/04/10 18:10
netarrow
ok allora è confermata la cosa detta da totem, nel tuo array non ci sono risultati.

per fare la ricerca nelle sotto directory ricorsivamente hai un esempio su msdn nel link di prima:
msdn.microsoft.com/en-us/library/…(v=VS.100).aspx

Te lo incollo anche qui:

' For Directory.GetFiles and Directory.GetDirectories
' For File.Exists, Directory.Exists 

Imports System
Imports System.IO
Imports System.Collections

Public Class RecursiveFileProcessor

    Public Overloads Shared Sub Main(ByVal args() As String)
        Dim path As String
        For Each path In args
            If File.Exists(path) Then
                ' This path is a file.
                ProcessFile(path)
            Else
                If Directory.Exists(path) Then
                    ' This path is a directory.
                    ProcessDirectory(path)
                Else
                    Console.WriteLine("{0} is not a valid file or directory.", path)
                End If
            End If
        Next path
    End Sub 'Main


    ' Process all files in the directory passed in, recurse on any directories 
    ' that are found, and process the files they contain.
    Public Shared Sub ProcessDirectory(ByVal targetDirectory As String)
        Dim fileEntries As String() = Directory.GetFiles(targetDirectory)
        ' Process the list of files found in the directory.
        Dim fileName As String
        For Each fileName In fileEntries
            ProcessFile(fileName)

        Next fileName
        Dim subdirectoryEntries As String() = Directory.GetDirectories(targetDirectory)
        ' Recurse into subdirectories of this directory.
        Dim subdirectory As String
        For Each subdirectory In subdirectoryEntries
            ProcessDirectory(subdirectory)
        Next subdirectory

    End Sub 'ProcessDirectory

    ' Insert logic for processing found files here.
    Public Shared Sub ProcessFile(ByVal path As String)
        Console.WriteLine("Processed file '{0}'.", path)
    End Sub 'ProcessFile
End Class 'RecursiveFileProcessor
aaa
26/04/10 15:59
giogiogio1213
Tutto chiaro adesso! funziona alla grande ^^
aaa