|
-
Sep 21st, 2000, 03:54 PM
#1
Thread Starter
Lively Member
How can I check to see if a file exists and what its size is on an FTP site? So far I have this:
Code:
With Inet1
.Cancel
.Protocol = icFTP
.URL = "FTP://ftp.whatever.com"
.UserName = "username"
.Password = "password"
.Execute , _
"RENAME UPLOAD/old.txt UPLOAD/new.txt"
DoLoop
.Execute , "QUIT"
End With
I want to make sure the file exists before I rename it and compare its size to the size of the file on my pc.
VB6 & VC++6 Pro (SP4), Java (Sun JDK)
-
Sep 21st, 2000, 04:35 PM
#2
Fanatic Member
I don't believe you can retrieve remote file size using the inet control. But to check if the file exists, simply attempt to download/rename it and if it doesn't then you'll get an error and just have error handling to make sure your ftp keeps running.
Gl,
D!m
-
Sep 21st, 2000, 04:40 PM
#3
Thread Starter
Lively Member
The problem is that I DONT get an error when I attempt to rename a file that doesn't exist. I know there is a Inet.Execute "DIR...." command as well as a Inet.Execute "SIZE...." command, but I don't know how to use them and the VB Help is not helpful.
VB6 & VC++6 Pro (SP4), Java (Sun JDK)
-
Sep 21st, 2000, 05:50 PM
#4
Dim is right, I don't believe there is a way to get the file size of something you did not download to your computer.
But you can check if it exists by trying to download it (or at least open it)..take a look at this thread for how to do that.
-
Sep 21st, 2000, 05:53 PM
#5
Thread Starter
Lively Member
Thanks guys. I'll probably use Inet.Execute "Get ...." and download the file to a temp directory on my pc. Then I'll compare its size to the size of the original file that is already on my pc.
VB6 & VC++6 Pro (SP4), Java (Sun JDK)
-
Sep 21st, 2000, 10:14 PM
#6
Member
Or you can do this
dim s$
Inet1.Execute Inet1.URL, "DIR myFilename.txt"
s$ = inet1.GetChunk(1024)
You can then check if your filename exists on the string passed returned by Getchuck method. this can only check if the file exists. hope this help
Mikey
A/P
Using VB6 SP4 Enterprise Ed.
-
Sep 22nd, 2000, 12:58 AM
#7
Lively Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|