Link to home
Create AccountLog in
Windows Batch

Windows Batch

--

Questions

--

Followers

Top Experts

Avatar of steven
steven🇺🇸

Bat file to sync a directory.
Our network admin is trying to create a .bat file to sync a ftp site.  The file runs but then cannot find the directory.  I have attached screen shots of the bat file while running.  The bat file uses

This the batch file.......without the real ftp of course...

# option batch abort
# option confirm off
open ftp://certs@Helloworld-inc.com:password@Helloworld-inc.com -passive=off
synchronize remote d:\share\certs\new /
close

It connects to the ftp and then gets to comparing, loses connection and then  disconnected  from server.
So this is what we see.

comparing...
Local 'dD\shar\cers\new => Remote '/'
Lost connection
Disconnected from server
Could not retrieve directory listing
TYPE is now ASCII
Error listing directory '/'.
Session closed.


Any help would be much appreciated.  He has search on the web for over a week and still cannot get this to run.

Thank you.

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of Bill PrewBill Prew

What FTP client are you using?

Did you paste the log info in, or type it fresh, since a couple of lines seem wrong:

Local 'dD\shar\cers\new => Remote '/'

Open in new window

Also, does the user being used for the FTP session have access to the root folder?

Try connecting with the same FTP client in an interactive session, and see if you can list the remote directory from that.

ls /

Open in new window

~bp

Avatar of QlemoQlemo🇩🇪

This is neither a .bat/.cmd nor a FTP file fpr the default FTP client, so giving advice is very difficult without more details.
However, is obvious that the local dir output looks garbled. Maybe issues with the backslash?

Also, I would typically expect double quotes in the FTP control file rather than single, but your client (WinSCP?) may accept either.

~bp

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


Avatar of Steven CarnahanSteven Carnahan🇺🇸

This does appear to be a WinSCP script.  

Try changing this line:

synchronize remote d:\share\certs\new /

to

synchronize remote "d:\share\certs\new" "/"

Avatar of stevensteven🇺🇸

ASKER

It is a WinSCP script, and above was a typo..dD.   Script is:

 open ftp://certs@Helloworld-inc.com:password@Helloworld-inc.com -passive=off
 synchronize remote d:\share\certs\new /
 close

The user does have access to root, that is what the client tell us, we are unsure how to test with a interactive session.  

We added double quotes as above, we are still unable to connect.  ERROR below.

comparing...
 Local 'd:\shar\cers\new => Remote '/'
 Lost connection
 Disconnected from server
 Could not retrieve directory listing
 TYPE is now ASCII
 Error listing directory '/'.
 Session closed.

Try my LS suggestion mentioned above please to confirm you can access that folder on the remote server.

~bp

Free T-shirt

Get a FREE t-shirt when you ask your first question.

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of stevensteven🇺🇸

ASKER

Bill,

Thanks again our network admin does not know how to do a interactive session.  Could you advise?

I tried

FTP open //certs@Helloworld-inc.com  

I got unknown host.  Sorry we are trying.

You will need to run the WinSCP program in GUI mode from the Start menu.  Then connect to the FTP server in that, and see if you can navigate to the root folder in WinSCP.

~bp

Avatar of stevensteven🇺🇸

ASKER

Yes we are able to access root, it worked just fine.  Thanks

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


ASKER CERTIFIED SOLUTION
Avatar of Bill PrewBill Prew

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

Avatar of stevensteven🇺🇸

ASKER

That did it.  Thank you very much for the help!!

Welcome, glad it was that simple.

~bp
Windows Batch

Windows Batch

--

Questions

--

Followers

Top Experts

Batch files are text files containing a script of commands that are executed by the command interpreter on DOS, OS/2 and Windows systems. Most commonly, they are used to perform a series of functions that are repeated -- copying a set of files created daily with one step, for example.