Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP transfer

Status
Not open for further replies.

Matta25

Technical User
Jan 6, 2004
82
US
I am do an FTP download from a remote site and the filename of the file being downloaded our 82-86 characters. When the script downloads the file it only saves the last 6 characters. If I open a procomm windows and drag the file manually the whole filename is copied over fine. Any ideas why this happens?
 
Does procomm have a limit to the number of character in a file name?
 
To the best of my knowledge, any filename limit in Procomm should be identical to the limit in Windows. However, strings in Procomm are limited to 256 characters, so if you are building a path and filename in ASPECT, it's possible you could run into this problem. Does the transfer succeed in Procomm using your script, indicating that the filename is created successfully?


aspect@aspectscripting.com
 
i'm just using a remote copyfile command to copy the files from the remote site to my pc. the names are "VAN-123456789-08022004-142145-UNC123456789-IC1234567890.edi-997.edi" when procomm transfers these file all i get is 997.edi and with multiple 997.edi file to download they get overwritten.
thanks
 
I created a file with that name on an FTP server I have access to and was able to download it via a quick script and it kept the filename intact. Can you post the portion of your script where you are downloading the file? Also, does the filename itself have double quotes?


aspect@aspectscripting.com
 
This is the filename in question:
VAN-OHSUBID00123-WV_MMIS_4UNISYS-20040803-020003-161664-004010X096A1-P.edi-824.edi
The script transfers the file and all I get on the local site is 824.edi If is drag the file over to the local site I get the whole name.
Any Ideas.

Here is the modified FTP script from Knob web site:

sFileSpec = "C:\test" ;Set path to Procomm Plus directory
strcat sFileSpec "\FILELIST.TXT" ;Add filename to path
sPath1 = "/test/Out" ;Set path that we want to download from
sConnection = "Myconnection" ;Connection Directory entry to connect to
dial FTP sConnection ;Make connection to FTP site
iStatus = $FTPCONNECT
while (iStatus == 1) ;Wait until connection is established
yield
iStatus = $FTPCONNECT
endwhile
pause 1
switch iStatus
case 3
Copyfile ErrMsg1 NegEmail ;Connection attempt failed, perform error handling
termmsg "Did not connect to the FTP site. `r`n"
goto Cleanup
endcase
case 2
if not nullstr sPath1 ;If path on FTP server specified
ftp remote chdir sPath1 ;Change to that remote directory
endif
ftp remote filelist sFileSpec ;Get list of files from FTP server
while $FTPSTATUS
yield
endwhile
fopen 0 sFileSpec READ TEXT ;Open list of files from FTP server
while not feof 0 ;Loop while file still has data
fgets 0 sData ;Get line of data from file
if strfind sData ".edi"
FTP local chdir "C:\test"
pause 2
ftp remote copyfile sData
termmsg "Downloaded file %s `r`n" sData
sData2 = sData
strreplace sData2 ".edi" ".old"
ftp remote rename sdata sdata2
while $FTPSTATUS ;Loop while file is being copied
yield
endwhile
endif
endwhile
fclose 0 ;Close file
delfile sFileSpec ;Delete local copy of FTP filelist
endcase
endswitch
Pause 5
disconnect ;Disconnect from FTP server
 
It looks to me like there is a string length limitation somewhere between 75 and 80 characters (didn't get it more exact than that). I'll play with it some more tonight and see if I can come up with a workaround, but I'm not very hopeful.


aspect@aspectscripting.com
 
if the string length is only 75 - 80 characters why would in only return 824.edi part of the filename and not the first 75-80 charactes.
 
I'm not sure why it only returns the last part of the filename, but if I renamed the file on the FTP server so that it was only about 75 characters long, then the entire filename came through. For example, if I left this string out of the filename:

-004010X096A1-P

then the remaining filename would come through completely using the script. I think I was able to leave all but the X096A1-P string in the filename until the incorrect name started appearing. It is nothing in that substring itself causing the problem as I could remove part of the beginning of the filename but leave the end, and the whole filename would be transferred again.


aspect@aspectscripting.com
 
Knob, do you know of a way to just keep say the last 30 characters of the filename. All i would need is 004010X096A1-P.edi-824.edi. can you rename the file when it is transferring the file.
Thanks again.
 
Hello Knob,
Here is how I got this to work. I have to log in and get the filelist of the files on the remote site then rename the files on the remote site to shorten them, then get a new filelist and then download the file I need and replace the .edi to .old. This was a hard one. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top