(view source code of ftpdir.bat as plain text)
@ECHO OFF
SETLOCAL
:: Modify variables as needed
SET FtpSite=ftp.myownsite.com
SET FtpUser=myftpuserid
SET RemoteDir=www
:: Check if password is specified on command line
IF X%1==X GOTO Syntax
:: Create temporary ftp script:
:: User ID
> %Temp%.\%~n0.ftp ECHO %FtpUser%
:: Password (as specified on command line)
>>%Temp%.\%~n0.ftp ECHO %1
:: Go to directory
>>%Temp%.\%~n0.ftp ECHO cd %RemoteDir%
:: Dir command
>>%Temp%.\%~n0.ftp ECHO dir
:: Quit
>>%Temp%.\%~n0.ftp ECHO bye
:: Execute the temporary ftp script
FTP -s:%Temp%.\%~n0.ftp %FtpSite%
:: For the paranoid: thoroughly destroy the temporary
:: ftp script because it contains the password:
:: [1] Overwrite its content
ECHO.> %Temp%.\%~n0.ftp
FOR /L %%A in (1,1,1000) DO ECHO.>>%Temp%.\%~n0.ftp
:: [2] Reduce file size to 0 bytes
TYPE NUL > %Temp%.\%~n0.ftp
:: [3] Delete the file
DEL %Temp%.\%~n0.ftp
:: Done
GOTO End
:Syntax
ECHO.
ECHO FtpDir.bat, Version 1.01 for Windows NT 4 / 2000
ECHO List files on a (remote) FTP site
ECHO.
ECHO Usage: %~n0 password
ECHO.
ECHO "password" is the password to get access to the remote FTP site.
ECHO.
ECHO This batch file demonstrates the use of FTP scripts.
ECHO It can be used in other OS versions too with a few minor modifications.
ECHO You will need to modify this batch file's variables section before using it.
ECHO.
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com
:End
ENDLOCAL
page last modified: 2024-04-16; loaded in 0.0092 seconds