2014-05-23 43 views
0

我想從遠程服務器使用Vb腳本中的ftp憑據讀取文件大小,我有下面的代碼返回遠程文件大小爲零。我做錯了什麼? 。請幫幫我,您的解決方案可以在這裏認識使用VBscript從遠程服務器讀取時,文件大小返回零

Dim fso, folder1, folder2, folder2a 
Set fso = CreateObject("Scripting.FileSystemObject") 
Set folder2a = fso.GetFolder("C\samples\") 
ftpFolderString = "ftp://xxx:[email protected]/Folder" 
targetFoldder = "C\samples" 
Dim SH, txtFolderToOpen, thing 
Set SH = CreateObject("Shell.Application") 
Set folder1 = SH.NameSpace(ftpFolderString) 
Set folder2 = SH.NameSpace(targetFoldder) 
For Each item In folder1.items 
MsgBox item.size 
For Each item2 In folder2a.Files 
    If item2.size< item.Name Then 
    ..do stuff    
    End IF 
    Next 
Next 

我得到遠程文件大小zero.Could你PL幫助我什麼,我出了問題該腳本

回答

0

雖然文檔不吭聲,通常某些對象屬性在遠程項目上不可用。嘗試使用fso對象大小屬性。這是完全不同的機制。

從幫助

Function ShowFolderSize(filespec) 

    Dim fso, f, s 

    Set fso = CreateObject("Scripting.FileSystemObject") 

    Set f = fso.GetFolder(filespec) 

    s = UCase(f.Name) & " uses " & f.size & " bytes." 

    ShowFolderSize = s 

End Function 
0

3號線一個錯字?

"C\samples\" 

應該

"C:\samples\" 
相關問題