FTP command "get *.txt" error "550 File not Found" - batch-file

My problem appears when I try to download files with a batch file over the FTP.
OPEN 192.168.0.1
test
password
lcd Download-dir
cd /filedir
BINARY
get *.txt
Everything works well up to the moment he try to find the File. At that moment he call the
Error 550 File not Found.
When I try the same with
get Test.txt
It will work fine.
Every tutorial use the * as wildcard but why does it not work for me.
Thanks for help.

The get command in ftp.exe does not support wildcards.
You have to use the mget command:
mget *.txt

Related

NetWare: MGET filenames which contains multiple dots from FTP server

I'm trying to download a file from an FTP using a script:
Script.bat
ftp -s:DownloadFiles.ftp
DownloadFiles.ftp
open ftp_server
user
pass
ascii
prompt
lcd D:\LocalPath
mget "File.*.TXT_T;1"
When I run the Script.bat I get the following error:
550-Failed to open CV0:[user]File^^^.20171104_024043.TXT_T; for input
. 550 file not found
According to this link, the problem seems to be that the file name contains multiple dots and the mget command will not found the file. Updating the server might solve the problem but I can't do that.
Has anyone dealt with this before?

Batch Script responds with "Error opening script file" when opening FTP file

I want to use a Batch file to upload files from a folder on my computer.
When I call the FTP Script to do the upload:
FTP -v -i -s:ftp.txt
or
FTP -v -i -s:c:\path\to\file\ftp.txt
Neither of those works, and instead
Error opening script file: ftp.txt
is returned.
Strange thing is, that the exact same script is being executed without problems on another computer.
Opening the batch file with admin-rights does not help. I'm running Windows 10.
Edit: The ftp.txt looks like this:
open ##host##
##user##
##password##
lcd c:\local\path\
cd path/on/server/
binary
mput "*.xxx"
disconnect
bye
Make a new, empty file with echo >ftp.test and try with that file.
If that gives you the same error, you'll need to look at your execution environment (look at set and the process owner of cmd.exe). It's also possible that the ftp command is being run as a user that doesn't have access to that file.
If you don't get an error then it's probably either a file-permissions or special-character issue with ftp.txt. Retyping the same content into a different file will get around those issues. Remember not to copy/paste because you could accidentally copy invisible special characters that you're trying to avoid.
I would like to add to this conversation since there have been a lot of views and no solution. I had the same response and it wasn't a permissions issue. It was also no the text file that was the issue because it never technically reached the text file. It was the path to the text file. The following for me didn't work. I had to put quotations around the path even though there were no spaces to confuse the command line.
What you tried:
FTP -v -i -s:c:\path\to\file\ftp.txt
What I tried and worked. (I didn't need to use -v, mine works without it)
FTP -i -s:"c:\path\to\file\ftp.txt"
Running the file acted normal for me. My issue was trying to run the batch file through Windows Task Manager. Somehow, this was causing it to lose the text file somehow. I hope this helps anyone else who reads this thread.
I had to put the .txt file path in the "Start In" section for it to work in Windows Task Manager. No problems since.

FTP script failing [duplicate]

This question already has answers here:
How to ftp with a batch file?
(10 answers)
Closed 4 years ago.
I am trying to create a script which copies the contents of one directory to an FTP location but every example I have tried to work with has failed. I need this to target a folder within the FTP site can anyone point me in the right direction.
Thank you
Batch file is below.
#ftp -i -s:"%~f0"&GOTO:EOF
open 0.0.0.0
name#address.com
Pa55word
!:--- FTP commands below here ---
lcd c:\program files\system\location
cd storage
binary
mput "*.*"
disconnect
bye
Once FTP is open you are no longer at a command prompt. You are inside FTP. You need to use your batch file to write the ftp script,FTPInstructions.ftp in the following example. Then open ftp, telling it to run the script.
When you invoke the ftp.exe program to run the ftp script from the batch file you can redirect the ftp.exe console output to a log file and examine that log file for errors. You'll need to redirect both stdout and stderr. Something like this:
echo open 0.0.0.0>FTPInstructions.ftp
echo user UserName>>FTPInstructions.ftp
echo Password>>FTPInstructions.ftp
echo something>>FTPInstructions.ftp
echo something else>>FTPInstructions.ftp
.
.
echo bye>>FTPInstructions.ftp
ftp.exe -n -s:FTPInstructions.ftp>FTPSession.log 2>&1
You can then use FIND or FINDSTR in the batch file to locate any error messages output by ftp.exe in the FTPSession.log file.

FTP Glob won't work

I have a problem with ftp via command line.
This is how I run the ftp file:
ftp -i -s:backup.ftp
pause
And this is my ftp file:
open HOST
USER
PASS
mget *.json
disconnect
quit
I am getting an error: no such file or directory. However if I change the * by a specific filename, it will work. As you can see, I didn't turn globbing off.
Also, when I connect to another ftp server, globbing does work. It seems like this ftp server blocks globbing or something. Anyone an idea??

Encountering erros when trying to automate PSFTP command using a .bat file

In looking at other posts, "Batch file for PuTTY/PSFTP file transfer automation", regarding automating the PSFTP command in a .bat file so that I can setup a Windows Scheduled Task, I tried the following but got the error below:
In the .bat file that I'm executing I have the following lines:
#echo off
cd "c:\PuTTY"
psftp 999.99.999.999 -l XXXXXIO -i testGSX.ppk -b DownloadDiscoverReports.txt
In the DownloadDiscoverReports.txt file I have the following lines:
lcd c:\Reports\GSXDLFILES\ALLRPTS
cd /DSCVROUT/ALLRPTS/
mget *ALLRPTS%POLLABLE*
lcd c:\Reports\GSXDLFILES\XMIT81
cd /DSCVROUT/XMIT81/
mget *XMIT81%POLLABLE*
The error I'm getting when I execute the .bat file from my C:\ is:
C:\>gsx_dl.bat
psftp: no hostname specified; use "open host.name" to connect
New local directory is c:\Reports\GSXDLFILES\ALLRPTS
psftp: not connected to a host; use "open host.name"
C:\PuTTY>
Any suggestions/direction on how to fix this issue would be appreciated. Thank you.
This issue has been resolved. PuTTY support responded to my issue and I entered a -v switch to my command and found that my KEY had expired and that was the issue.
Thanks anyway.

Resources