本文介绍了我试图通过FTP传输pdf文件,但一旦pdf文件被转移,他们就会受到损害..还有另一种转移方式吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Dim myStreamWriter As StreamWriter = Nothing
Dim lngWnd As Long = Nothing
Dim strTxtfile As String = Nothing
Dim output2 As String

''''''''''''''''''''''''''''''''''''''''''' looping and Transferring
Dim varSourceAddress As String = "C:\Notification_Pdf"
Dim diaddr As New DirectoryInfo(varSourceAddress)
Dim fiaddr As FileInfo() = diaddr.GetFiles()

While diaddr.GetFiles.Length > 0
    For Each scannedFile As FileInfo In fiaddr
        If scannedFile.Name.Contains("Thumbs") = False Then
            If scannedFile.Exists Then
                output2 = scannedFile.Name
                'output2 = scannedFile.Name.Replace(".docx", ".pdf")

                myStreamWriter = File.CreateText("C:\pdf\Notifications.txt")
                With myStreamWriter
                    .WriteLine("open 196.35.157.148")
                    .WriteLine("securemailftp")
                    .WriteLine("secretmailptf")
                    .WriteLine("lcd C:\Notification_Pdf")
                    .WriteLine("get" & " " & output2)
                    .WriteLine("put" & " " & output2)
                    .WriteLine("byee")
                    .WriteLine("close")
                    .Flush()
                    myStreamWriter.Close()
                End With
                strTxtfile = "C:\pdf\Notifications.txt"
                lngWnd = Shell("ftp -s:" & strTxtfile, vbMinimizedFocus)
                'scannedFile.CopyTo("C:\Notificationss\Archive\" & output2, True)
            End If
        End If
    Next scannedFile
End While
Me.Label1.Text = "Files Transferred"

推荐答案

这篇关于我试图通过FTP传输pdf文件,但一旦pdf文件被转移,他们就会受到损害..还有另一种转移方式吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 13:21