Home > Software engineering >  Through DOS access to FTP directory file list
Through DOS access to FTP directory file list

Time:09-26

I want to know how to get through the DOS command FTP a directory below all of the file name, such as remote FTP user password for 192.168.1.199 already know, I have a directory under the FTP ABC this directory A.t in the file name and under the xt, B.t xt... , and then name is uncertain, it is random, I how can iterate through all of the file name to generate a Txt file, and then save to my current directory

CodePudding user response:

Fyi:
 ServerShare="\ \ 192.168.3.56 \ d $" 
The UserName="somedomain \ someuser"
Password="somepassword"

The Set NetworkObject=CreateObject (" work "WScript.Net

NetworkObject. MapNetworkDrive ", "ServerShare, False, UserName, Password,"

The Set of FSO=CreateObject (" Scripting. FileSystemObject ")
Set the Directory=FSO. GetFolder (ServerShare)
For Each FileName In the Directory. The Files
WScript. Echo FileName. The Name
Next
Set the FileName=Nothing
Set the Directory=Nothing
The Set of FSO=Nothing

NetworkObject. RemoveNetworkDrive ServerShare, True, False

The Set NetworkObject=Nothing

CodePudding user response:

reference 1st floor zhao4zhong1 response:
are for reference only:
 ServerShare=\ \ "192.168.3.56 \ d $" 
The UserName="somedomain \ someuser"
Password="somepassword"

The Set NetworkObject=CreateObject (" work "WScript.Net

NetworkObject. MapNetworkDrive ", "ServerShare, False, UserName, Password,"

The Set of FSO=CreateObject (" Scripting. FileSystemObject ")
Set the Directory=FSO. GetFolder (ServerShare)
For Each FileName In the Directory. The Files
WScript. Echo FileName. The Name
Next
Set the FileName=Nothing
Set the Directory=Nothing
The Set of FSO=Nothing

NetworkObject. RemoveNetworkDrive ServerShare, True, False

The Set NetworkObject=Nothing
FTP and network sharing files are two different things,

First set up a file such as 1. TXT, assumptions on disk c, the content is:
The open 180.178.57.244
The user
Password
Dir/ABC
The quit

Then in the batch file write: FTP -s: c: \ 1. TXT & gt; C: \ log. TXT

In other language, thus results the screen again

CodePudding user response:

refer to the second floor sysdzw response:
FTP and network sharing files are two different things,

First set up a file such as 1. TXT, assumptions on disk c, the content is:
The open 180.178.57.244
The user
Password
Dir/ABC
The quit

Then in the batch file write: FTP -s: c: \ 1. TXT & gt; C: \ log. TXT

In other language, thus results the screening again

Mark...

1. The first command of TXT open, can explain the usage?
I just tried it on, can't follow the open orders in the DOS ah,

CodePudding user response:

I recently always rub a cubic centimeter of sand from my eyes! Eyesight fails,

CodePudding user response:

reference Chen8013 reply: 3/f
Quote: refer to the second floor sysdzw response:


FTP and network sharing files are two different things,

First set up a file such as 1. TXT, assumptions on disk c, the content is:
The open 180.178.57.244
The user
Password
Dir/ABC
The quit

Then in the batch file write: FTP -s: c: \ 1. TXT & gt; C: \ log. TXT

In other language, thus results the screening again

Mark...

1. The first command of TXT open, can explain the usage?
I just tried it on, it is impossible to carry out the open in the DOS command,
you have to enter the FTP in DOS then press enter, you can use FTP commands, open just FTP inside of a command, there are a lot of other, such as the famous PWD, CD etc.

CodePudding user response:

Be FPT command to be executed first,

I first performed under DOS FTP/? Looked at it with the help of the information,
Then, I will enter the open make it perform... ...

CodePudding user response:

reference Chen8013 reply: 3/f
Quote: refer to the second floor sysdzw response:


FTP and network sharing files are two different things,

First set up a file such as 1. TXT, assumptions on disk c, the content is:
The open 180.178.57.244
The user
Password
Dir/ABC
The quit

Then in the batch file write: FTP -s: c: \ 1. TXT & gt; C: \ log. TXT

In other language, thus results the screening again

Mark...

1. The first command of TXT open, can explain the usage?
I just tried it on, can't follow the open orders in the DOS ah,


The OPen is can OPen a FTP is to enter the user and password below

CodePudding user response:


First set up a file such as 1. TXT, assumptions on disk c, the content is:
The open 180.178.57.244
The user
Password
Dir/ABC
The quit

Then in the batch file write: FTP -s: c: \ 1. TXT & gt; C: \ log. TXT

Now I have Dir for return a result, the problem is how to get the result returned

CodePudding user response:

@ echo off
<" % ~ f0 "more + 4 & gt; T
FTP -s: t
The exit/b
The open IP
UserID
The PWD
Dir
The quit
The Dir can be displayed on the screen, but if I use the Dir d: \ which xt which he xt is not displayed, do

CodePudding user response:

references 9 f qq_30255557 response:
@ echo off
<" % ~ f0 "more + 4 & gt; T
FTP -s: t
The exit/b
The open IP
UserID
The PWD
Dir
The quit
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related