View previous topic :: View next topic |
Author |
Message |
DanTheMan Contributor
Joined: 15 Mar 2002 Posts: 56 Location: Sweden
|
Posted: Thu Aug 21, 2003 1:50 pm Post subject: VDSIPP Quest? |
|
|
Just wonder if it's possible to use multiple file upload with vdsipp FTP protocol.
example. INTERNET FTP,PUTFILE,1,*.dat,*.dat or only one file at a time ?.
If not would that mean I can't use the events generated in that command.
I want to upload all files (*.dat) from a local site to an FTP-server site and
have control (events) that's everything works just fine. If I have to send one file at the time (in a loop) it's a little bit "tricky" to use the event features I guess ?. Please Someone ! |
|
Back to top |
|
|
PGWARE Web Host
Joined: 29 Dec 2001 Posts: 1563
|
Posted: Thu Aug 21, 2003 2:19 pm Post subject: |
|
|
STANDARD Ftp protocol only allows one file at a time to be uploaded or downloaded. If you have an ftp client that does otherwise it basically is just setting up multiple connections to download/upload files.
VDSIPP - An event is generated each time a file has finished uploading, so if you want to add a progress bar to your program showing how much left/many files left you can roughly either do this two ways:
By file sizes and checking how many files have been sent and how many files left and then calculate by the files left (bytes) / total files (bytes).
You just need to keep a list of all files and get their total amount in bytes. Then anytime a file is uploaded you can remove it from this list and check the amount of bytes left for all files, this can give you a percentage of how many files uploaded.
- OR -
A more generic approach is to take the total # of files and then the # of files already uploaded and divide the two, this will give you a percentage as well, not as acurate as the above example since it doesn't take into consideration the file size which really is the real measure of progress done.
If you need to upload multiple files and use events you can do this a safe way without breaking out of a repeat:
Code: |
%%totalfiles = 10
%%currentfiles = 0
:repeatstartloop
repeat
INTERNET FTP,PUTFILE,1,somefile%%currentfiles,somefile%%currentfiles
%%currentfiles = @succ(%%currentfiles)
%%lastevent = @event()
until @equal(%%totalfiles, %%currentfiles) @equal(%%lastevent, FTP1ONPUTFILEDONE)
if @equal(%%lastevent, FTP1ONPUTDONE)
goto FTP1ONPUTFILEDONE
else
goto evloop
end
:FTP1ONPUTDONE
warn %%currentfiles of %%totalfiles uploaded
if @not(@equal(%%totalfiles, %%currentfiles))
goto repeatstartloop
else
goto evloop
end
|
Last edited by PGWARE on Thu Aug 21, 2003 2:32 pm; edited 1 time in total |
|
Back to top |
|
|
moke Contributor
Joined: 02 Jan 2002 Posts: 162
|
Posted: Thu Aug 21, 2003 2:23 pm Post subject: |
|
|
Hi Dan,
I don't think you can use a wild card with FTP, but the events should be easy once you work them out. Somethig like this should work OK. I haven't tested it but the idea should work. The events work like any other VDS event so if you go back to the evloop you can wait for it to occur.
Hope this helps,
moke
Code: |
:MAKELIST
LIST CREATE,1
LIST FILELIST, C:\*.DAT
LIST SEEK,1,0
%%NEXTFILE = @ITEM(1)
IF @GREATER(@COUNT(1),1)
LIST SEEK,1,1
END
:FTPLOGON
INTERNET FTP,CREATE,1
INTERNET FTP,THREADS,1,ON
INTERNET FTP,AUTHENTICATE,1,%%FTPUSER,%%FTPPW
INTERNET FTP,CONNECT,1,%%FTPSITE,21
GOTO EVLOOP
:FTP1ONCONNECT
INTERNET FTP,PUTFILE,1,%%NEXTFILE
GOTO EVLOOP
:FTP1ONPUTFILEDONE
%%NEXTFILE = @NEXT(1)
IF %%NEXTFILE
GOTO FTP1ONCONNECT
ELSE
INTERNET FTP,DESTROY,1
GOTO EVLOOP
END
|
|
|
Back to top |
|
|
PGWARE Web Host
Joined: 29 Dec 2001 Posts: 1563
|
Posted: Thu Aug 21, 2003 2:38 pm Post subject: |
|
|
I think MOKE's code is much better, you should probably use that, my example was very generic compared to his |
|
Back to top |
|
|
DanTheMan Contributor
Joined: 15 Mar 2002 Posts: 56 Location: Sweden
|
Posted: Thu Aug 21, 2003 7:33 pm Post subject: |
|
|
Thanks for your help, this forum is great !.
/Dan |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|