使用FTP批处理脚本删除ftp文件夹中的所有文件 您所在的位置:网站首页 ftp如何删除上传文件的内容 使用FTP批处理脚本删除ftp文件夹中的所有文件

使用FTP批处理脚本删除ftp文件夹中的所有文件

2024-07-15 23:30| 来源: 网络整理| 查看: 265

这是一个完整而安全的解决方案!

一件事是,你必须对每个文件都有一个'y‘,如果你有太多的文件,这并不重要,你可以有数百个,它只需要几秒钟,并给出你永远看不到的错误消息。

临时文件在与bat文件相同的文件夹中创建,并将被脚本擦除。

您也可以使用mdelete *,即使dir *显示子文件夹中的所有文件。

代码语言:javascript复制@echo off echo.   :MENU cls echo. echo What do you want to do? echo. echo 1 - Delete all files in a folder at FTP using ftp batch script echo 2 - Cancel echo 3 - Logout echo. set /p choice= if %choice%==1 goto sure if %choice%==2 goto cancel if %choice%==3 goto ? echo Invalid Choice echo. pause goto MENU :sure echo. echo Are you sure to delete all files y/n echo. set /p choice= if %choice%==y goto delete if %choice%==Y goto delete if %choice%==n goto cancel if %choice%==N goto cancel echo Invalid Choice echo. pause goto sure :delete echo open my-domain.com> temp.txt echo username>> temp.txt echo password>> temp.txt echo cd public_html/directoryname>> temp.txt echo mdelete *.*>> temp.txt echo y>> temp.txt echo y>> temp.txt echo y>> temp.txt echo y>> temp.txt echo y>> temp.txt echo y>> temp.txt echo y>> temp.txt echo y>> temp.txt echo y>> temp.txt echo y>> temp.txt echo y>> temp.txt echo y>> temp.txt echo y>> temp.txt echo y>> temp.txt echo y>> temp.txt echo y>> temp.txt echo y>> temp.txt echo y>> temp.txt echo y>> temp.txt echo y>> temp.txt echo y>> temp.txt echo y>> temp.txt echo y>> temp.txt echo y>> temp.txt echo y>> temp.txt echo y>> temp.txt echo y>> temp.txt echo y>> temp.txt echo y>> temp.txt echo quit>> temp.txt REM Start FTP and send it to the script ftp -s:temp.txt REM delete the temp-file del temp.txt cls echo. echo All files are deleted! echo. pause goto MENU :cancel echo. echo You have cancelled the erasement! echo. Pause goto MENU


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有