Error opening script file - location error

Hello,

I know nothing about UNIX, ftp, etc. I am building an excel VBA macro which calls a .bat file. I've taken a pre-existing batch file and am trying to modify it to fit my purposes. I would be very grateful for some assistance.

Here is my .bat file:

echo off
set tempfile="serverX\temp.txt"
> %tempfile% echo open focprd
>>%tempfile% type "serverX\download.xls"
>>%tempfile% echo bye 
ftp -s:"%tempfile%"
del %tempfile%
exit

So, my problem is with the line of code: ftp -s:"%tempfile%"

In the ftp, I get a line which says there is an error opening script file and then it gives me a partial location of where the file is located.

The temp file is created exactly how I want it and in the location I want, I just can't get the temp file to open in ftp.

One side note which may or may not be of importance. The file is located in a location similar to this: serverX/AB - Here.

When the ftp fails to open the script, it shows the location of the file as only serverX/AB. It does not include the "-" and everything after it. But if ftp can create the temp file in this location, I do not see how it has an issue running the script. Thanks again for whatever help I get.

ok once i wrote a script transferring data from windows to solaris. I try to help :

first of all "s" option comes with ftp means that your ".bat" script which includes ftp line will call codes from a .txt file ( that include main ftp codes like hash, mput etc).

second your ".bat" should be located in same directory as the txt file. So check if your ".bat" file calls the "serverX\temp.txt" from right place, this is so important. Let me give a very simple example too:

batch script:

@ftp -i -d -v -s:test_123.txt
cd \files2transfer
del /s "*.txt"

test_123.txt file which includes ftp:

@Echo Off
open "Server IP her e"
root
"root_password_here"

lcd D:\Backup2\backup
cd /LOGS/applications_backup/IVR

binary
hash on
mput "*.rar"
disconnect
bye

Does the path have a space in it anywhere? It may be considering only the part of the file up to the space as the argument.

FTP means File Transfer Protocol. It is used for transferring file from one node to another place. The fundamental parameters to FTP are: Destination Server Address, Username, Password, file type (ASCIII/Binary), Source Filename, Destination Filename.

Your batch file contains multiple syntax and logic errors on every line.
It is not possible based on the evidence presented to determine what the MSDOS Batch File is intended to do.

Ignoring syntax etc. what do it the MSDOS Batch File intended to do?
Hints:
What is the Network name of the destination Server?
What is the ftp username and password? (don't post real ones).
What is the format of the file (ASCII/Binary)?
What is the name of the source file?
What is the name of the destination file?

Hello again. Thank you very much for the responses. I will try to answer your questions to the best of my ability. I am in a location where I cannot access the files, but I should be able to answer by memory.

Eagle - I will double check the that the .bat file calls the .txt file from the right location, but I doubt this is the issue because I was meticulous in creating the files. And yes, I believe the .bat file and the .txt file which get created are located in the same directory. They are both stored in the same folder.

Corona - The path does have a space in it. How would I get ftp to consider the entire path? As I mentioned in my first post, the error appears to be at the space. Perhaps restating it will help. The files are saved in a location: U:shared/common/FA - Files

The error says it cannot run the script from the location. In the ftp it shows only: U:shared/common/FA.

It is missing the last "- Files". Without changing the folder name, how can I correct this?

Methyl - I did not reveal enough information to make the .bat file's complete intent. This .bat file is based on a larger VBA project in a different application. The batch file is intended to create a temporary file which pulls data from an excel spreadsheet (the data changes). The spreadsheet is set up in such a way that it contains all the remaining proper syntax required to transfer all the files I need. Once the spreadsheet's data has been pasted into the temporary .txt file, the .txt file is complete will all the data I need. At this point, the .bat file is supposed to "run" this .txt file in ftp.

In my first post, I mentioned the .txt file is created exactly how I need it. I can manually type out the .txt file in ftp and it works as it is supposed to. The issue I have is why the .bat file cannot run the .txt file through ftp in the location it currently is. I know very little about Unix and ftp so it does not surprise me that the syntax or logic is bad, but for my purposes, I think the functionality is very nearly complete.

The network name of the server is: U:shared/common/FA - Files
Everything including the excel sheet, .bat file, and .txt file which gets created are all located in the folder called "FA - Files". I am not 100% sure of the format. I know the excel file is a special format. I "borrowed" it from other processes which use ftp. Source file, destination file, and ftp username and passwords are all in the excel file - which correctly go into the .txt file.

Thanks again guys. I'm hoping these details can help clear things up. I think the space in the path name is my issue. Changing this will not be easy unfortunately.

You could try using 8dot3 paths, which will avoid using characters like spaces but refer to the same existing file. Run dir /X in a DOS window to see what a file or dir's 8dot3 name is. "C:\Documents and Settings\Administrator\" may become "C:\DOCUME~1\ADMINI~1\" and so forth.

Hey Corona. That might not be a bad idea. And I appreciate the help you've given thus far, but I don't quite follow how to find the 8dot3 path. I have Windows XP, could you be a little more specific in how I can go about finding the 8dot3 path? Thanks a lot for your help.

click start, click run, type in 'cmd', hit enter.

In the DOS prompt:

cd c:\path\to\dir-containing-file

substituting in your actual directory of course. Then:

dir /X

and it will show a listing of file names in that directory. The column one from the right contains 8dot3 names, so you can see the 8dot3 name for your file. Then

cd ..
dir /X

so you can see the 8dot3 name of dir-containing-file. Then

cd ..
dir /X

again so you can see the 8dot3 name of 'to'.

rinse and repeat until you have the 8dot3 names of your file and everything leading to it. Now you can squash them together into a hideous path like "c:\path_na~1\dir_nam~1\file_na~1" which, while ugly and unreadable, should be accepted by Windows and Windows applications.

Thanks for the patience you've shown so far Corona. I am still struggling. The path is on a different server, so I think that is now presenting me with another problem. The error I get in the CMD screen is "CMD does not support UNS paths as current directories".

I'm getting pretty frustrated at this point. I'm beginning to think I will not be able to do this project and might need a UNIX person to do it.

Oh.

Remote paths in Windows are "special". I doubt MS commandline FTP supports remote paths even if you get past the space in the name problem.

You can map remote paths into drive letters with the NET USE tool, though:

NET USE X: \\server\path\to\

my_command < x:\input > x:\output

NET USE X: /DELETE

Once you map it in, you might be able to get the 8.3 name(if such things even apply to network drives). Or if the space is just in the path, perhaps avoid it entirely.