home *** CD-ROM | disk | FTP | other *** search
- ; Example24.ftp
- ; =============
- ; This example demonstrates how to retrieve the list
- ; of files both from a remote server as well as
- ; from a local folder. The retrieved list is
- ; written out to two different Textfiles.
- ; ----------------------------------------------
- ; Commands demonstrated:
- ; REMOTE-LIST
- ; LOCAL-LIST
- ; OUTOPUTOPEN
- ; OUTPUTWRITE
- ; OUTPUTCLOSE
- ; EDITFILE
- ; ----------------------------------------------
-
- NumVariable i
-
- Host="ftp.transsoft.com"
- User="Anonymous"
- Port=21
- Password=" OS'OI+NL_nTNO "
-
- connect
- Local-cd "C:\Windows"
- remote-cd "pub"
-
- ; Read list of all EXE files on the Remote Server:
- ; The list of filenames are stored in varables called:
- ; REMOTEFILES_1, REMOTEFILES_2, ..., REMOTEFILES_x
- remote-list "*"
-
- ; Read list of all INI files in the Local Folder:
- ; The list of filenames are stored in varables called:
- ; LOCALFILES_1, LOCALFILES_2, ..., LOCALFILES_x
- Local-list "*.*"
-
- ; Write the list of remote files to the file: Remote.res on C-drive's root:
- OutputOpen 1 "C:\Remote.res"
-
- ; Write the list of local files to the file: Local.res on C-drive's root:
- OutputOpen 2 "C:\Local.res"
-
- ; Write the header of the results files:
- OutputWrite 1 "%%NUMREMOTEFILES%% files were found on Remote Server"
- OutputWrite 1 "%%NUMREMOTEDIRS%% directories were found on Remote Server"
- OutputWrite 1 "----------------------------"
- OutputWrite 1 "///// Files \\\\\"
- OutputWrite 1 "----------------------------"
- OutputWrite 2 "%%NUMLOCALFILES%% files were found in Local folder"
- OutputWrite 2 "%%NUMLOCALDIRS%% directories were found in Local folder"
- OutputWrite 2 "----------------------------"
- OutputWrite 2 "///// Files \\\\\"
- OutputWrite 2 "----------------------------"
-
-
- Let i=0
- :NextFile
- if %%i%% < %%NumRemoteFiles%% then
- Let i = i + 1
- OutputWrite 1 "%%REMOTEFILES_[%%i%%]%% %%REMOTEDATES_[%%i%%]%%"
- endif
- if %%i%% < %%NumRemoteFiles%% then
- goto NextFile
- endif
-
- OutputWrite 1 "----------------------------"
- OutputWrite 1 "///// Directories \\\\\"
- OutputWrite 1 "----------------------------"
-
- Let i=0
- :NextDir
- if %%i%% < %%NumRemoteDirs%% then
- Let i = i + 1
- OutputWrite 1 "%%REMOTEDIRS_[%%i%%]%%"
- endif
- if %%i%% < %%NumRemoteDirs%% then
- goto NextDir
- endif
-
- Let i=0
- :NextLocalFile
- if %%i%% < %%NumLocalFiles%% then
- Let i = i + 1
- OutputWrite 2 "%%LOCALFILES_[%%i%%]%% %%LOCALDATES_[%%i%%]%%"
- endif
- if %%i%% < %%NumLocalFiles%% then
- goto NextLocalFile
- endif
-
- OutputWrite 2 "----------------------------"
- OutputWrite 2 "///// Directories \\\\\"
- OutputWrite 2 "----------------------------"
-
- Let i=0
- :NextLocalDir
- if %%i%% < %%NumLocalDirs%% then
- Let i = i + 1
- OutputWrite 2 "%%LocalDIRS_[%%i%%]%%"
- endif
- if %%i%% < %%NumLocalDirs%% then
- goto NextLocalDir
- endif
-
- OutputClose 1
- OutputClose 2
-
- EditFile A "C:\Remote.res"
- EditFile A "C:\Local.res"
-
- disconnect
-