Torna indietro   Hardware Upgrade Forum > Software > Programmazione

iPhone 17 Pro: più di uno smartphone. È uno studio di produzione in formato tascabile
iPhone 17 Pro: più di uno smartphone. È uno studio di produzione in formato tascabile
C'è tanta sostanza nel nuovo smartphone della Mela dedicato ai creator digitali. Nuovo telaio in alluminio, sistema di raffreddamento vapor chamber e tre fotocamere da 48 megapixel: non è un semplice smartphone, ma uno studio di produzione digitale on-the-go
Intel Panther Lake: i processori per i notebook del 2026
Intel Panther Lake: i processori per i notebook del 2026
Panther Lake è il nome in codice della prossima generazione di processori Intel Core Ultra, che vedremo al debutto da inizio 2026 nei notebook e nei sistemi desktop più compatti. Nuovi core, nuove GPU e soprattutto una struttura a tile che vede per la prima volta l'utilizzo della tecnologia produttiva Intel 18A: tanta potenza in più, ma senza perdere in efficienza
Intel Xeon 6+: è tempo di Clearwater Forest
Intel Xeon 6+: è tempo di Clearwater Forest
Intel ha annunciato la prossima generazione di processori Xeon dotati di E-Core, quelli per la massima efficienza energetica e densità di elaborazione. Grazie al processo produttivo Intel 18A, i core passano a un massimo di 288 per ogni socket, con aumento della potenza di calcolo e dell'efficienza complessiva.
Tutti gli articoli Tutte le news

Vai al Forum
Rispondi
 
Strumenti
Old 21-12-2010, 19:27   #1
lucausa75
Senior Member
 
L'Avatar di lucausa75
 
Iscritto dal: Jun 2001
Città: Catania
Messaggi: 2690
[VB 2010] - Controllare file su FTP

Salve ragazzi,

con questa porzione di codice riesco a collegarmi ad un mio FTP:

Codice:
    Public Function CheckIfFileContains(ByVal Path As String, ByVal SearchStr As String) As Boolean
        Dim RetList = New List(Of String)

        If (Path = Nothing Or Path = "") Then
            Path = "/"
        End If

        _FtpRequest = CType(WebRequest.Create("ftp://" + _Host + Path), FtpWebRequest)
        _FtpRequest.Credentials = New NetworkCredential(_UserName, _Password)
        _FtpRequest.UsePassive = False
        _FtpRequest.Method = WebRequestMethods.Ftp.ListDirectoryDetails
        _FtpRequest.EnableSsl = _UseSSL
        _FtpRequest.Proxy = Nothing
        _FtpResponse = CType(_FtpRequest.GetResponse(), FtpWebResponse)
vorrei aggiungere le righe di codice necessarie in modo da verificare se tra i file nell'FTP c'è qualcuno il cui nome contiene una stringa da me prescelta e che fa diventare la funzione di cui sopra CheckIfFileContains TRUE...
lucausa75 è offline   Rispondi citando il messaggio o parte di esso
Old 21-12-2010, 20:51   #2
MarcoGG
Senior Member
 
L'Avatar di MarcoGG
 
Iscritto dal: Dec 2004
Messaggi: 3210
Già provato con qualcosa come :
Codice:
Public Function CheckIfFtpFileExists(ByVal fileUri As String) As Boolean  
    Dim request As FtpWebRequest = WebRequest.Create(fileUri)   
    request.Credentials = New NetworkCredential("username", "password")   
    request.Method = WebRequestMethods.Ftp.GetFileSize   
  
    Try  
        Dim response As FtpWebResponse = request.GetResponse()   
        ' THE FILE EXISTS   
    Catch ex As WebException   
        Dim response As FtpWebResponse = ex.Response   
        If FtpStatusCode.ActionNotTakenFileUnavailable = response.StatusCode Then  
            ' THE FILE DOES NOT EXIST   
            Return False  
        End If  
    End Try  
    Return True  
End Function
?
__________________
Contattami su FaceBook --> [ ::: MarcoGG su FaceBook ::: ]
Visita il mio Blog --> [ ::: Il Blog di MarcoGG ::: ]
MarcoGG è offline   Rispondi citando il messaggio o parte di esso
Old 22-12-2010, 08:10   #3
lucausa75
Senior Member
 
L'Avatar di lucausa75
 
Iscritto dal: Jun 2001
Città: Catania
Messaggi: 2690
Quote:
Originariamente inviato da MarcoGG Guarda i messaggi
Già provato con qualcosa come :
Codice:
Public Function CheckIfFtpFileExists(ByVal fileUri As String) As Boolean  
    Dim request As FtpWebRequest = WebRequest.Create(fileUri)   
    request.Credentials = New NetworkCredential("username", "password")   
    request.Method = WebRequestMethods.Ftp.GetFileSize   
  
    Try  
        Dim response As FtpWebResponse = request.GetResponse()   
        ' THE FILE EXISTS   
    Catch ex As WebException   
        Dim response As FtpWebResponse = ex.Response   
        If FtpStatusCode.ActionNotTakenFileUnavailable = response.StatusCode Then  
            ' THE FILE DOES NOT EXIST   
            Return False  
        End If  
    End Try  
    Return True  
End Function
?
...ci avevo pensato ma non riesco ad implementarla; cercavo qualcosa come una sorta di ciclo for che analizzasse tutti i file di una directory FTP e se il file esaminato contiene una stringa STR riempiva una variabile
lucausa75 è offline   Rispondi citando il messaggio o parte di esso
Old 22-12-2010, 11:04   #4
lucausa75
Senior Member
 
L'Avatar di lucausa75
 
Iscritto dal: Jun 2001
Città: Catania
Messaggi: 2690
Eccola quì fresca fresca di sviluppo:

Codice:
    Public Function CheckIfFileContain(ByVal Path As String, ByVal SearchStr As String, ByVal _Username As String, ByVal _Password As String) As String
        Dim Request As FtpWebRequest = WebRequest.Create(Path)
        Request.Credentials = New NetworkCredential(_Username, _Password)
        Request.UsePassive = False
        Request.Method = WebRequestMethods.Ftp.ListDirectory
        Request.EnableSsl = _UseSSL
        Request.Proxy = Nothing

        Dim Response As FtpWebResponse = Request.GetResponse()
        Dim Streamer As Stream = Response.GetResponseStream()
        Dim Reader As New StreamReader(Streamer)
        Dim StrLine As String
        Dim CountContains As Integer

        Do
            StrLine = Reader.ReadLine
            If StrLine <> Nothing Then
                If InStr(StrLine, SearchStr) > 0 Then
                    CountContains = CountContains + 1
                End If
            End If
        Loop While StrLine <> Nothing

        Select Case CountContains
            Case 0
                Return False
            Case Else
                Return True
        End Select

    End Function
lucausa75 è offline   Rispondi citando il messaggio o parte di esso
Old 22-12-2010, 11:17   #5
MarcoGG
Senior Member
 
L'Avatar di MarcoGG
 
Iscritto dal: Dec 2004
Messaggi: 3210
Ottimo, e funzia ?
__________________
Contattami su FaceBook --> [ ::: MarcoGG su FaceBook ::: ]
Visita il mio Blog --> [ ::: Il Blog di MarcoGG ::: ]
MarcoGG è offline   Rispondi citando il messaggio o parte di esso
Old 22-12-2010, 11:32   #6
lucausa75
Senior Member
 
L'Avatar di lucausa75
 
Iscritto dal: Jun 2001
Città: Catania
Messaggi: 2690
Quote:
Originariamente inviato da MarcoGG Guarda i messaggi
Ottimo, e funzia ?
Funziona di lusso!
lucausa75 è offline   Rispondi citando il messaggio o parte di esso
 Rispondi


iPhone 17 Pro: più di uno smartphone. È uno studio di produzione in formato tascabile iPhone 17 Pro: più di uno smartphone. &Eg...
Intel Panther Lake: i processori per i notebook del 2026 Intel Panther Lake: i processori per i notebook ...
Intel Xeon 6+: è tempo di Clearwater Forest Intel Xeon 6+: è tempo di Clearwater Fore...
4K a 160Hz o Full HD a 320Hz? Titan Army P2712V, a un prezzo molto basso 4K a 160Hz o Full HD a 320Hz? Titan Army P2712V,...
Recensione Google Pixel Watch 4: basta sollevarlo e si ha Gemini sempre al polso Recensione Google Pixel Watch 4: basta sollevarl...
Disney+ cambia: arriva Hulu, ma il servi...
Google annuncia Gemini Enterprise: l'IA ...
Battlefield 6 debutta tra code infinite ...
Gli iPhone di seconda mano dominano il m...
Pavel Durov (Telegram) lancia l'allarme:...
Occhiali Smart come lo smartphone: il fu...
Arriva NVIDIA GB300 NVL72, il cluster di...
Copilot si collega a OneDrive, Gmail e D...
Il Liquid Glass di iOS 26 è stato...
I biocarburanti fanno più danni d...
ELF, il Frankenstein di Mercedes che ant...
Da Kia arriva il passaporto per le batte...
The Elder Scrolls 6 renderà omagg...
YouTube dà una 'seconda chance' a...
Attacco hacker a Oracle E-Business Suite...
Chromium
GPU-Z
OCCT
LibreOffice Portable
Opera One Portable
Opera One 106
CCleaner Portable
CCleaner Standard
Cpu-Z
Driver NVIDIA GeForce 546.65 WHQL
SmartFTP
Trillian
Google Chrome Portable
Google Chrome 120
VirtualBox
Tutti gli articoli Tutte le news Tutti i download

Strumenti

Regole
Non Puoi aprire nuove discussioni
Non Puoi rispondere ai messaggi
Non Puoi allegare file
Non Puoi modificare i tuoi messaggi

Il codice vB è On
Le Faccine sono On
Il codice [IMG] è On
Il codice HTML è Off
Vai al Forum


Tutti gli orari sono GMT +1. Ora sono le: 03:01.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Served by www3v