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

  1. ; Example25.ftp
  2. ; =============
  3. ; This example copies the content of the file
  4. ; AUTOEXEC.BAT to another file, appending it
  5. ; to the new file if it does exist,
  6. ; otherwise creates the file.
  7. ; The files are opened and each line is read
  8. ; from one file and added to the other.
  9. ; -------------------------------------------
  10. ; Commands demonstrated:
  11. ;       OUTPUTAPPEND
  12. ;       OUTPUTWRITE
  13. ;       INPUTOPEN
  14. ;       INPUTREAD
  15. ;       ADDTOFILE 
  16. ;       EDITFILE
  17. ; -------------------------------------------
  18.  
  19.  
  20. OutputAppend 1 "C:\SytemsFiles.new"
  21. if success then 
  22.   goto next1
  23. endif
  24. Message "Could not open output file!"
  25. goto End
  26.  
  27. :Next1
  28. InputOpen 1 "C:\Autoexec.bat"
  29. if success then 
  30.   goto next2
  31. endif
  32. Message "Could not open input file!"
  33. goto End
  34.  
  35. :Next2
  36.  
  37. :NextLine
  38.  InputRead 1 A
  39.  if success then
  40.     OutputWrite 1 "%%A%%"
  41.     goto NextLine
  42.  endif  
  43.   
  44. OutputClose 1
  45. InputClose 1
  46.  
  47. ; Show the result by displaying the new file
  48. ; in the built in editor;:
  49. EditFile A "C:\SytemsFiles.new"
  50.  
  51. ; Add the text "FileEnd" to the end of the written file:
  52. AddToFile "C:\SytemsFiles.new" "--FileEnd--%%NEWLINE%%"
  53.  
  54. ; Show the result by displaying the new file
  55. ; in the built in editor;:
  56. EditFile A "C:\SytemsFiles.new"
  57.  
  58. :end
  59.