Sep 2, 2014 01:36 PM
Hey everyone.
This may be a repost, sorry if it is.. but I don't think I have posted this before.
It's an FTP client I wrote back in 2012, thought maybe it was something worth sharing.
Setup:
Spoiler (Click to View)
Files:
Spoiler (Click to View)
FTP Client.bat:
Go.bat:
Hope someone finds this useful, I was 14/15 when I wrote this so it's probably quite shit.
This may be a repost, sorry if it is.. but I don't think I have posted this before.
It's an FTP client I wrote back in 2012, thought maybe it was something worth sharing.
Setup:
Spoiler (Click to View)
- Create a folder.
- Inside that folder create a folder called "Method".
- Put Go.bat inside of the Methods folder.
- Put FTP Client.bat inside of Method's parent directory (the onee you created first)
- Run FTP Client
Files:
Spoiler (Click to View)
FTP Client.bat:
Code
::::PROGRAM_LOAD::::
@echo off
title Mr Liam's FTP
set show=0
set extra=0
mkdir Bookmarks
::::MENU::::
: main
cls
echo.
echo .: Connect options :.
echo.
echo 1) Open from bookmarks.
echo 2) Add to bookmarks.
echo 3) Remove from bookmarks.
echo.
set /p input=Select task:
if %input%==1 goto openconnection
if %input%==2 goto addtobookmarks
if %input%==3 goto removefrombookmarks
echo.
echo ERROR: %input% is not a valid task!
echo Press ENTER!
timeout 5 >nul
goto main
::::CONNACT::::
: openconnection
cls
if %show%==0 goto oc
dir Bookmarks\ /b /d
: oc
echo.
echo .: Bookmarks :.
echo.
set /p file=Bookmark:
if %file%==back goto main
if %file%==list set show=1
if %file%==list goto openconnection
if exist Bookmarks\%file%.bat goto go
echo.
echo File does not exist!
echo Press ENTER!
timeout 5 >nul
goto openconnection
: go
call Bookmarks\%file%.bat
echo Data loaded! Now going to menu with %host%
pause >nul
goto menu
::::Add Bookmark::::
: addtobookmarks
cls
echo.
echo .: Bookmarks - Add Bookmark :.
echo.
echo Fill in the details.
echo.
set /p bmn=Bookmark name:
set /p host=Host or IP:
set /p port=Port:
set /p user=Username:
set /p pass=Password:
cls
echo Now saving data...
pause >nul
cls
if exist Bookmarks\%bmn%.bat del Bookmarks\%bmn%.bat
echo set host=%host%>> Bookmarks\%bmn%.bat
echo set port=%port%>> Bookmarks\%bmn%.bat
echo set user=%user%>> Bookmarks\%bmn%.bat
echo set pass=%pass%>> Bookmarks\%bmn%.bat
cls
echo.
echo .: Bookmarks - Add Bookmark :.
echo.
echo Settings saved!
echo Press ENTER!
timeout 5 >nul
goto main
::::Delete Bookmark::::
: removefrombookmarks
cls
echo.
echo .: Bookmarks - Delete Bookmark :.
echo.
set /p bmn=Bookmark to remove:
if exist Bookmarks\%bmn%.bat goto dele
if not exist Bookmarks\%bmn%.bat goto notexist
: dele
del Bookmarks\%bmn%.bat
echo Deleted the bookmark!
pause >nul
goto main
: notexist
echo Bookmark does not exist!
pause >nul
goto main
: menu
set loc=Methods\%file%
set cmd=null
mkdir Methods\%file%\
cls
echo.
echo .: FTP menu :.
echo.
echo 1) Check connection
echo 2) Check directory
echo 3) Create directory
echo 4) Remove directory
echo 5) Upload file
echo 6) Download file
echo 7) Delete file
echo 8) Rename file
echo.
set /p input=Option:
if %input%==custom goto custom
if %input%==1 goto connect
if %input%==2 goto cd
if %input%==3 goto mkdir
if %input%==4 goto rmdir
if %input%==5 goto put
if %input%==6 goto recv
if %input%==7 goto delete
if %input%==8 goto rename
if %input%==ex set extra=1
if %input%==dx set extra=0
goto menu
: custom
call Bookmarks\%file%.bat
if not exist %loc%\custom.txt (
echo open %host%>> %loc%\custom.txt
echo %user%>> %loc%\custom.txt
echo %pass%>> %loc%\custom.txt
)
set cmd=custom
start Methods\Go.bat
goto end
: connect
call Bookmarks\%file%.bat
if not exist %loc%\connect.txt (
echo open %host%>> %loc%\connect.txt
echo %user%>> %loc%\connect.txt
echo %pass%>> %loc%\connect.txt
echo disconnect>> %loc%\connect.txt
echo ! echo You may now close the window.>> %loc%\connect.txt
echo ! timeout 60 /nobreak>> %loc%\connect.txt
)
set cmd=connect
start Methods\Go.bat
goto end
: cd
cls
set /p arg=Argument: /
call Bookmarks\%file%.bat
if exist %loc%\cd.txt del %loc%\cd.txt
if not exist %loc%\cd.txt (
echo open %host%>> %loc%\cd.txt
echo %user%>> %loc%\cd.txt
echo %pass%>> %loc%\cd.txt
echo ls %arg%>> %loc%\cd.txt
echo disconnect>> %loc%\cd.txt
echo ! echo You may now close the window.>> %loc%\cd.txt
echo ! timeout 60 /nobreak>> %loc%\cd.txt
)
set cmd=cd
start Methods\Go.bat
goto end
: mkdir
cls
set /p arg=Argument: /
call Bookmarks\%file%.bat
if exist %loc%\mkdir.txt del %loc%\mkdir.txt
if not exist %loc%\mkdir.txt (
echo open %host%>> %loc%\mkdir.txt
echo %user%>> %loc%\mkdir.txt
echo %pass%>> %loc%\mkdir.txt
echo mkdir %arg%>> %loc%\mkdir.txt
echo disconnect>> %loc%\mkdir.txt
echo ! echo You may now close the window.>> %loc%\mkdir.txt
echo ! timeout 60 /nobreak>> %loc%\mkdir.txt
)
set cmd=mkdir
start Methods\Go.bat
goto end
: rmdir
cls
set /p arg=Argument: /
call Bookmarks\%file%.bat
if exist %loc%\rmdir.txt del %loc%\rmdir.txt
if not exist %loc%\rmdir.txt (
echo open %host%>> %loc%\rmdir.txt
echo %user%>> %loc%\rmdir.txt
echo %pass%>> %loc%\rmdir.txt
echo rmdir %arg%>> %loc%\rmdir.txt
echo disconnect>> %loc%\rmdir.txt
echo ! echo You may now close the window.>> %loc%\rmdir.txt
echo ! timeout 60 /nobreak>> %loc%\rmdir.txt
)
set cmd=rmdir
start Methods\Go.bat
goto end
: put
cls
set /p file1=File:
set /p file2=Directory: /
call Bookmarks\%file%.bat
if exist %loc%\put.txt del %loc%\put.txt
if not exist %loc%\put.txt (
echo open %host%>> %loc%\put.txt
echo %user%>> %loc%\put.txt
echo %pass%>> %loc%\put.txt
echo cd %file2%>> %loc%\put.txt
echo put %file1%>> %loc%\put.txt
echo disconnect>> %loc%\put.txt
echo ! echo You may now close the window.>> %loc%\put.txt
echo ! timeout 60 /nobreak>> %loc%\put.txt
)
set cmd=put
start Methods\Go.bat
goto end
: recv
cls
set /p dir=Directory of file: /
set /p arg=File:
call Bookmarks\%file%.bat
if exist %loc%\recv.txt del %loc%\recv.txt
if not exist %loc%\recv.txt (
echo open %host%>> %loc%\recv.txt
echo %user%>> %loc%\recv.txt
echo %pass%>> %loc%\recv.txt
echo cd %dir%>> %loc%\recv.txt
echo recv %arg% %arg%>> %loc%\recv.txt
echo disconnect>> %loc%\recv.txt
echo ! echo You may now close the window.>> %loc%\recv.txt
echo ! timeout 60 /nobreak>> %loc%\recv.txt
)
set cmd=recv
start Methods\Go.bat
goto end
: delete
cls
set /p dir=Directory of file: /
set /p arg=File:
call Bookmarks\%file%.bat
if exist %loc%\delete.txt del %loc%\delete.txt
if not exist %loc%\delete.txt (
echo open %host%>> %loc%\delete.txt
echo %user%>> %loc%\delete.txt
echo %pass%>> %loc%\delete.txt
echo cd %dir%>> %loc%\delete.txt
echo delete %arg%>> %loc%\delete.txt
echo disconnect>> %loc%\delete.txt
echo ! echo You may now close the window.>> %loc%\delete.txt
echo ! timeout 60 /nobreak>> %loc%\delete.txt
)
set cmd=delete
start Methods\Go.bat
goto end
: rename
cls
set /p dir=Directory of file: /
set /p arg=File:
set /p arg2=New name:
call Bookmarks\%file%.bat
if exist %loc%\rename.txt del %loc%\delrenamete.txt
if not exist %loc%\rename.txt (
echo open %host%>> %loc%\rename.txt
echo %user%>> %loc%\rename.txt
echo %pass%>> %loc%\rename.txt
echo cd %dir%>> %loc%\rename.txt
echo rename %arg% %arg2%>> %loc%\rename.txt
echo disconnect>> %loc%\rename.txt
echo ! echo You may now close the window.>> %loc%\rename.txt
echo ! timeout 60 /nobreak>> %loc%\rename.txt
)
set cmd=rename
start Methods\Go.bat
goto end
: end
goto menuGo.bat:
Code
if %extra%==0 (
ftp -s:%loc%\%cmd%.txt
)
if %extra%==1 (
ftp -v -s:%loc%\%cmd%.txt
)Hope someone finds this useful, I was 14/15 when I wrote this so it's probably quite shit.


![[Image: chain.png]](https://i.postimg.cc/NFnfH9zY/chain.png)