home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / rxiutl16.zip / urlget.txt < prev   
Text File  |  2000-01-10  |  8KB  |  185 lines

  1. URL file fetcher v0.16
  2.  
  3. This utility is intended as a quick way to grab files from remote servers 
  4. by URL.  
  5.  
  6. The reason this was written is because I quite often am presented, in one 
  7. way or another, with a URL pointing to a file that I want or need.  What I 
  8. don't want or need is to load up a fat web browser, or cut and paste parts 
  9. of the URL into an FTP client.
  10.  
  11. The result is urlget.cmd, written in Object REXX, using the REXX Sockets 
  12. API.
  13.  
  14. The program will correctly parse the URL you give it and download the file 
  15. from the remote server using the appropriate protocol; FTP or HTTP.
  16.  
  17. The usage:
  18.  
  19. urlget.cmd [/q] <URL name ;[local name] | @file> [/q]
  20.  
  21. URL name is any valid HTTP or FTP URL, such as:
  22.  
  23. http://www.somewhere.com/index.html
  24. ftp://ftp.somewhere.com/pub/files/something.zip
  25. ftp://user:password@ftp.somewhere.com/userdir/something.zip
  26.  
  27. With a FTP URL, a hostname without any security information prompts 
  28. urlget.cmd to assume a username of 'anonymous', with the password being the 
  29. e-mail address it asks you for the first time you run the program.
  30.  
  31. If the URL contains spaces, type it normally.  It is not necessary to 
  32. enclose it in quotes, though that's acceptable as well.
  33.  
  34. [local name] corresponds to an alternate name to store the file locally as.  
  35.  
  36. This can be a simple filename, or a fully specified pathname.  The default 
  37. is to store the file locally with the same name as its remote counterpart.
  38.  
  39. An exception to this is when the working drive uses the FAT file system, or 
  40. the drive pointed to by a fully specified alternate name uses the FAT file 
  41. system.  More on that below.
  42.  
  43. The @file option (used instead of a URL) should be the name of a plain text 
  44. file with one or more URL's on separate lines.  Lines beginning with '//',
  45. '/*', '#', and ';' are ignored, so you can create one-line comments for
  46. URL's, if you so desire.  Local storage names can optionally be placed at
  47. the end of the URL, separated from it by a semicolon, such as:
  48.  
  49. http://www.somewhere.com/somedir/somefile.zip ; thisfile.zip
  50.  
  51. If the drive to which the file will be stored is formatted with the FAT 
  52. file system, then the name will be changed automatically to be compatible, 
  53. if not done so manually.
  54.  
  55. If the remote filename is not FAT-compatible and no compatible local name 
  56. is given, or if the given local name isn't FAT-compatible, then random name 
  57. generation occurs.
  58.  
  59. The random name chosen is just a hexadecimal 32-bit integer (eight 
  60. characters, characters 0-9 and A-F).  If the extension of the remote or 
  61. locally named file is three characters long, that will be the extension of 
  62. the random filename.  If not, then the extension .UGF will be used.
  63.  
  64. The original name isn't discarded, however, whether it be the remote 
  65. filename, or the user's desired local storage name.  The name in question 
  66. will be written to the new file's .LONGNAME extended attribute.  WPS file 
  67. folders will display this name, as will any other utilities that display 
  68. the attribute, such as OS/2's COMMAND.COM in DOS sessions.
  69.  
  70. If one copies or moves the file to a drive supporting long filenames with 
  71. the WPS, the name on the new drive will be the one stored in .LONGNAME.  
  72. The same is true if using a recent version of 4OS2, also.
  73.  
  74. Except when using FAT-compatible naming, any local files will be 
  75. overwritten.  That is, if a file exists in the working directory that 
  76. matches the name at the end of the URL, or the name you specify points to 
  77. an existing file, it will be overwritten.  With FAT-compatible naming, due 
  78. to the random nature of the chosen name, nothing will be overwritten.
  79.  
  80. At the end of the transfer, a stats line will show the total bytes 
  81. transferred, total time, and the transfer rate.
  82.  
  83. urlget.cmd is too large for tokenization into the EA's, but for better 
  84. performance, you can still tokenize it to a separate file, using the 
  85. rexxc.exe utility that comes with Object REXX.  Simply do this:
  86.  
  87. ren urlget.cmd urlget.old
  88. rexxc urlget.old urlget.cmd
  89.  
  90. urlget.cmd will then be a binary file full of REXX tokens, which will 
  91. execute more quickly than the text source file.
  92.  
  93. Options:
  94.  
  95. /q - operate in quiet mode
  96.  
  97. This prevents the status display, which shows bytes stored, current 
  98. transfer rate, total bytes expected (when known), and percentage completion 
  99. (contingent on knowing total, naturally).
  100.  
  101. /qq - operate in super quiet mode
  102.  
  103. This suppresses all output (logging is still performed, if enabled).  Use
  104. this if you're calling urlget.cmd from a script, and don't want to mess up
  105. your display.
  106.  
  107. /r - attempt FTP resume if file exists and is smaller than server copy
  108.  
  109. This will set the restart marker for FTP servers that support it, if the 
  110. local filename exists, and is smaller than the copy on the server.  The 
  111. transfer will commence normally if the remote file size can't be 
  112. determined, or the server doesn't support resume (the local file will be 
  113. overwritten).
  114.  
  115. /f - attempt FTP resume, and abort transfer if not supported
  116.  
  117. This does the same as the /r option, except that the transfer is aborted if 
  118. the remote size can't be determined, or the server doesn't support resume.
  119.  
  120. /n - don't overwrite local files
  121.  
  122. This prevents any local files from being overwritten.  The transfer aborts
  123. before any network activity with this switch, if the local file exists.  If
  124. the size of the remote file can be determined, and it's the same as a local
  125. copy of the file, the transfer will be skipped.
  126.  
  127. /c - clobber local files (overridden by resume and forced resume)
  128.  
  129. This will overwrite the local file even if it's the same size as the copy
  130. on the server.
  131.  
  132. /p - attempt transfer even if passive mode denied while behind firewall
  133.  
  134. If you're configured as behind a firewall, this will attempt to do a normal 
  135. transfer (with the server connecting to the client's data port) in the 
  136. event that the server refuses a passive mode connection.  If it works, then 
  137. you should configure yourself as not being behind a firewall, since passive 
  138. mode isn't necessary.  This would be the case with an intelligent proxy or
  139. IP masquerader.
  140.  
  141. /d# - delay time for FTP commands (seconds); default=0.1
  142.  
  143. Some FTP servers show an odd inability to handle fast interactions on the 
  144. control connection.  Therefore, there is a delay between each block of data 
  145. sent during FTP commands.  If you get odd transfer failures, try increasing 
  146. this number.
  147.  
  148. /b# - transfer block size (512-65535); default=10240
  149.  
  150. This is the maximum transfer block size.  In general, the larger the block, 
  151. the faster the transfer, as connection speed increases.  
  152.  
  153. /t# - status timing interval in 1/100th seconds (1-100); default=25
  154.  
  155. This is the update frequency for transfer status, which is done on a 
  156. separate thread.  The default value of 25 means that the bytes stored, 
  157. transfer rate, etc. will be written to the screen four times per second.  
  158. Lowering this value will make for more erratic reported transfer rates.  It 
  159. might also slow the transfer down, depending on the speed of your 
  160. connection, and the speed of your computer.  Increasing this value will 
  161. make the information less and less accurate, as your connection speed 
  162. increases.  
  163.  
  164. /m# - maximum retries on error (0-9999999999); default=1000
  165.  
  166. This is the amount of times that the program will attempt to get data from 
  167. the socket after errors before aborting the transfer attempt.
  168.  
  169. Exit codes:
  170.  
  171. 0 - Successful transfer of all files
  172. 1 - Successful transfer of at least one file (and failure of at least one)
  173. 2 - Parameter error
  174. 3 - Socket-level failure (single file only)
  175. 4 - Server-level failure (single file only)
  176. 5 - User abort with no successful transfers
  177. 6 - Program error, possibly some successful transfers, but unlikely
  178. 30 - Multiple errors, no successful transfers
  179. 255 - Unknown error, shouldn't happen
  180.  
  181.  
  182. Any questions, comments, complaints, etc., e-mail me at:
  183.  
  184.     <thannymeister@yahoo.com>
  185.