home *** CD-ROM | disk | FTP | other *** search
/ CD Shareware Magazine 1999 April / CD_Shareware_Magazine_31.iso / WIN95 / INTERNET / ftpctrl3b8.exe / %MAINDIR% / Scripts / Example24.ftp < prev    next >
Encoding:
Text File  |  1999-02-07  |  3.0 KB  |  112 lines

  1. ; Example24.ftp
  2. ; =============
  3. ; This example demonstrates how to retrieve the list 
  4. ; of files both from a remote server as well as
  5. ; from a local folder. The retrieved list is 
  6. ; written out to two different Textfiles.
  7. ; ----------------------------------------------
  8. ; Commands demonstrated:
  9. ;       REMOTE-LIST
  10. ;       LOCAL-LIST
  11. ;       OUTOPUTOPEN
  12. ;       OUTPUTWRITE
  13. ;       OUTPUTCLOSE
  14. ;       EDITFILE
  15. ; ----------------------------------------------
  16.  
  17. NumVariable i
  18.  
  19. Host="ftp.transsoft.com"
  20. User="Anonymous"
  21. Port=21
  22. Password=" OS'OI+NL_nTNO "
  23.  
  24. connect
  25. Local-cd "C:\Windows"
  26. remote-cd "pub"
  27.  
  28. ; Read list of all EXE files on the Remote Server:
  29. ; The list of filenames are stored in varables called:
  30. ;    REMOTEFILES_1, REMOTEFILES_2, ..., REMOTEFILES_x
  31. remote-list "*"
  32.  
  33. ; Read list of all INI files in the Local Folder:
  34. ; The list of filenames are stored in varables called:
  35. ;    LOCALFILES_1, LOCALFILES_2, ..., LOCALFILES_x
  36. Local-list "*.*"
  37.  
  38. ; Write the list of remote files to the file: Remote.res on C-drive's root:
  39. OutputOpen 1 "C:\Remote.res"
  40.  
  41. ; Write the list of local files to the file: Local.res on C-drive's root:
  42. OutputOpen 2 "C:\Local.res"
  43.  
  44. ; Write the header of the results files:
  45. OutputWrite 1 "%%NUMREMOTEFILES%% files were found on Remote Server"
  46. OutputWrite 1 "%%NUMREMOTEDIRS%% directories were found on Remote Server"
  47. OutputWrite 1 "----------------------------"
  48. OutputWrite 1 "/////      Files       \\\\\"
  49. OutputWrite 1 "----------------------------"
  50. OutputWrite 2 "%%NUMLOCALFILES%% files were found in Local folder"
  51. OutputWrite 2 "%%NUMLOCALDIRS%% directories were found in Local folder"
  52. OutputWrite 2 "----------------------------"
  53. OutputWrite 2 "/////      Files       \\\\\"
  54. OutputWrite 2 "----------------------------"
  55.  
  56.  
  57. Let i=0
  58. :NextFile
  59.  if %%i%% < %%NumRemoteFiles%% then
  60.     Let i = i + 1
  61.     OutputWrite 1 "%%REMOTEFILES_[%%i%%]%%    %%REMOTEDATES_[%%i%%]%%"
  62.  endif 
  63.  if %%i%% < %%NumRemoteFiles%% then
  64.     goto NextFile
  65.  endif  
  66.  
  67. OutputWrite 1 "----------------------------"
  68. OutputWrite 1 "/////   Directories    \\\\\"
  69. OutputWrite 1 "----------------------------"
  70.  
  71. Let i=0
  72. :NextDir
  73.  if %%i%% < %%NumRemoteDirs%% then
  74.     Let i = i + 1
  75.     OutputWrite 1 "%%REMOTEDIRS_[%%i%%]%%"
  76.  endif 
  77.  if %%i%% < %%NumRemoteDirs%% then
  78.     goto NextDir
  79.  endif  
  80.  
  81. Let i=0
  82. :NextLocalFile
  83.  if %%i%% < %%NumLocalFiles%% then
  84.     Let i = i + 1
  85.     OutputWrite 2 "%%LOCALFILES_[%%i%%]%%    %%LOCALDATES_[%%i%%]%%"
  86.  endif 
  87.  if %%i%% < %%NumLocalFiles%% then
  88.     goto NextLocalFile
  89.  endif  
  90.  
  91. OutputWrite 2 "----------------------------"
  92. OutputWrite 2 "/////   Directories    \\\\\"
  93. OutputWrite 2 "----------------------------"
  94.  
  95. Let i=0
  96. :NextLocalDir
  97.  if %%i%% < %%NumLocalDirs%% then
  98.     Let i = i + 1
  99.     OutputWrite 2 "%%LocalDIRS_[%%i%%]%%"
  100.  endif 
  101.  if %%i%% < %%NumLocalDirs%% then
  102.     goto NextLocalDir
  103.  endif  
  104.  
  105. OutputClose 1
  106. OutputClose 2
  107.  
  108. EditFile A "C:\Remote.res"
  109. EditFile A "C:\Local.res"
  110.  
  111. disconnect
  112.