forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


VDSIPP Quest?

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
DanTheMan
Contributor
Contributor


Joined: 15 Mar 2002
Posts: 56
Location: Sweden

PostPosted: Thu Aug 21, 2003 1:50 pm    Post subject: VDSIPP Quest? Reply with quote

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
View user's profile Send private message
PGWARE
Web Host


Joined: 29 Dec 2001
Posts: 1563

PostPosted: Thu Aug 21, 2003 2:19 pm    Post subject: Reply with quote

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
View user's profile Send private message
moke
Contributor
Contributor


Joined: 02 Jan 2002
Posts: 162

PostPosted: Thu Aug 21, 2003 2:23 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
PGWARE
Web Host


Joined: 29 Dec 2001
Posts: 1563

PostPosted: Thu Aug 21, 2003 2:38 pm    Post subject: Reply with quote

I think MOKE's code is much better, you should probably use that, my example was very generic compared to his Smile
Back to top
View user's profile Send private message
DanTheMan
Contributor
Contributor


Joined: 15 Mar 2002
Posts: 56
Location: Sweden

PostPosted: Thu Aug 21, 2003 7:33 pm    Post subject: Reply with quote

Thanks for your help, this forum is great !. Very Happy

/Dan
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
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

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group