Code: Select all
(echo open -u FtpAddress
echo FtpUsername
echo FtpPassword
echo mkdir AAA
echo cd AAA
echo mkdir 1A
echo mkdir 2B
echo mkdir 3C
echo cd ..
echo rm -r )|ncftp
Worth a try.
Moderator: DosItHelp
Code: Select all
(echo open -u FtpAddress
echo FtpUsername
echo FtpPassword
echo mkdir AAA
echo cd AAA
echo mkdir 1A
echo mkdir 2B
echo mkdir 3C
echo cd ..
echo rm -r )|ncftp
Squashman wrote:I know with the builtin Windows FTP.exe program you can actually pipe your commands to the program. Maybe you can do that with ncpftp as well.Code: Select all
(echo open -u FtpAddress
echo FtpUsername
echo FtpPassword
echo mkdir AAA
echo cd AAA
echo mkdir 1A
echo mkdir 2B
echo mkdir 3C
echo cd ..
echo rm -r )|ncftp
Worth a try.
Code: Select all
(echo open -u 138.201.29.24
echo test@update.iranisc.ir
echo testuL4O92t2Go~3
echo mkdir BBB
echo mkdir AAA
echo cd AAA
echo mkdir 1A
echo mkdir 2B
echo mkdir 3C
echo cd ..
echo rm -r )|ncftp
pause
Code: Select all
@echo off &setlocal
set "uname=test@abc.def.ir"
set "passw=test12345"
set "hostn=ftp://abc.def.ir"
set "rootdir=Root"
set "lsfile=dirlist.txt"
set "ftpscript=test.ftp"
>"%lsfile%" (
for /f "tokens=8 delims=;" %%i in (
'ncftpls -u "%uname%" -p "%passw%" -R -m "%hostn%" ^| findstr /xrc:"type=dir;..*;[ ]*%rootdir%/[^;][^;]*"'
) do for /f "tokens=*" %%j in ("%%i") do echo %%j
)
>"%ftpscript%" (
for /f "delims=" %%i in ("%hostn%") do echo open %%~nxi
echo %uname%
echo %passw%
for /f "delims=" %%i in ('sort /r "%lsfile%"') do (
echo cd %%i
echo mdel *
echo cd ..
for %%j in ("%%i") do echo rmdir %%~nxi
echo cd /
)
echo disconnect
echo bye
)
ftp.exe -i -s:"%ftpscript%"