China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-04 15:22
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to search for the file or folder I want on an FTP View 1,680 Replies 10
Original Poster Posted 2007-05-08 09:50 ·  中国 上海 电信
中级用户
★★
过度热情
Credits 321
Posts 139
Joined 2006-03-21 17:19
20-year member
UID 52521
Gender Male
Status Offline
How to search for the file or folder I want on an FTP? Scripts or tools can be used.
知识在于不断积累
Floor 2 Posted 2007-05-08 10:49 ·  中国 上海 电信
中级用户
★★
过度热情
Credits 321
Posts 139
Joined 2006-03-21 17:19
20-year member
UID 52521
Gender Male
Status Offline
知识在于不断积累
Floor 3 Posted 2007-05-08 13:23 ·  中国 甘肃 兰州 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
Floor 4 Posted 2007-05-08 14:12 ·  中国 上海 浦东新区 电信
中级用户
★★
Credits 302
Posts 138
Joined 2007-03-29 02:33
19-year member
UID 83224
Gender Male
Status Offline

echo open ip>1.txt
echo username>>1.txt
echo password>>1.txt
echo ls>>1.txt
echo bye>>1.txt
ftp -s:1.txt>1.log
findstr /b /e /c:"donghua" 1.log>2.txt && goto :cd
goto :eof
:cd
for /f "delims=" %%i in (2.txt) do set fdname=%%i
echo open ip>1.txt
echo username>>1.txt
echo password>>1.txt
echo cd %fdname%>>1.txt
ftp -s:1.txt


The above mainly completes the process of logging in to the folder that the owner wants to log in to each time when logging in to FTP. It was tested successfully under XP, but there are 2 problems:
1. If you want to find a Chinese file name, it is not possible. If the directory name listed by ls under FTP is in Chinese, it will be represented in other ways. I don't know if it is a problem with the FTP server settings.
2. It can only find the directory name in the root directory after FTP login. If the desired directory is in a subdirectory of the directory, it cannot be completed. For example, if the donghua directory is in "root directory\123\donghua" of FTP, it cannot be found. The parameter of dir in FTP is invalid, so I don't know how to find all subdirectories of a specified directory similar to the function of dir /s.

[ Last edited by lililulula on 2007-5-8 at 02:21 PM ]
Floor 5 Posted 2007-05-08 15:57 ·  中国 上海 电信
中级用户
★★
过度热情
Credits 321
Posts 139
Joined 2006-03-21 17:19
20-year member
UID 52521
Gender Male
Status Offline
to: lililulula

Thanks in advance.!.. The key is to traverse and search all subdirectories under the FTP directory. Hope everyone can discuss more.


to vkill
.You mean the p-ftpls.BAT, I don't know how to use the parameters of the batch file you wrote specifically.
Can you send an example for reference, to achieve finding a file (traversing and searching all subdirectories under the FTP directory)
知识在于不断积累
Floor 6 Posted 2007-05-08 16:05 ·  中国 安徽 芜湖 电信
中级用户
★★
Credits 247
Posts 123
Joined 2007-04-17 06:29
19-year member
UID 85468
Gender Male
Status Offline
Floor 7 Posted 2007-05-08 16:24 ·  中国 上海 电信
中级用户
★★
过度热情
Credits 321
Posts 139
Joined 2006-03-21 17:19
20-year member
UID 52521
Gender Male
Status Offline
Just downloaded p-ftpls.BAT -s. Tried it out. It feels like it takes a really long time. Is there a way to make it a bit shorter in time?
知识在于不断积累
Floor 8 Posted 2007-05-08 16:47 ·  中国 上海 浦东新区 电信
中级用户
★★
Credits 302
Posts 138
Joined 2007-03-29 02:33
19-year member
UID 83224
Gender Male
Status Offline
I took a look at vkill's p-ftpls.bat and it completely dashed my hopes, but for the requirements of the thread starter, it can actually be achieved. First, use p-ftpls to traverse all directories and export to a text file, then use a batch script to perform the subsequent operations needed.
Floor 9 Posted 2007-05-08 17:19 ·  中国 上海 电信
中级用户
★★
过度热情
Credits 321
Posts 139
Joined 2006-03-21 17:19
20-year member
UID 52521
Gender Male
Status Offline
I spent more than 20 minutes traversing an FTP. Oh my. I don't know if you guys know if there are ready-made software (software developed with VC, VB, .NET, etc.). I want to use those advanced software which might handle traversal faster.
知识在于不断积累
Floor 10 Posted 2007-05-09 11:42 ·  中国 上海 电信
中级用户
★★
过度热情
Credits 321
Posts 139
Joined 2006-03-21 17:19
20-year member
UID 52521
Gender Male
Status Offline
I spent more than 20 minutes traversing an FTP. Oh my. I don't know if you guys know if there are ready-made software (software developed with VC, VB, .NET, etc.). I think using those advanced software might handle traversal faster.
知识在于不断积累
Floor 11 Posted 2007-05-09 12:10 ·  中国 四川 绵阳 江油市 电信
高级用户
★★★
Credits 502
Posts 327
Joined 2006-12-30 06:01
19-year member
UID 74981
Gender Male
Status Offline
The title of LZ has no restrictions in cmd. If it's Windows, you can try using flashfxp.
Forum Jump: