using the command line ftp
if I do a get on a file which ends in a . the final . gets dropped
why?
how can I retain it?
Printable View
using the command line ftp
if I do a get on a file which ends in a . the final . gets dropped
why?
how can I retain it?
Did you enclose it in "'s?
get "myfile."
Yep! Tried that!
Hmm looks like windows doesnt want a file to end with a period, when i try to create or rename a file to end with a period it always drops the ending period, 'test.' becomes 'test'.
This probbably applies to all windows versions:
Q115827 - INFO: Filenames Ending with Space or Period Not Supported
Quote:
INFO: Filenames Ending with Space or Period Not Supported
--------------------------------------------------------------------------------
The information in this article applies to:
Microsoft Win32 Application Programming Interface (API), used with:
Microsoft Windows NT Server versions 3.5, 3.51
Microsoft Windows NT Workstation versions 3.5, 3.51
Microsoft Windows 95
--------------------------------------------------------------------------------
CreateFile() removes trailing spaces and periods from file and directory names. This is done for compatibility with the FAT and HPFS file systems.
Problems can arise when a Macintosh client creates a file on a Windows NT server. The code to remove trailing spaces and periods is not carried out and the Macintosh user gets the correctly punctuated filename. The Win32 APIs FindFirstFile() and FindNextFile() return a filename that ends in a space or in a period; however, there is no way to create or open the file using the Win32 API.
Applications such as File Manager and Backup check to see whether the filename ends with a space or period. If the filename does end in a space or a period, then File Manager and Backup use the alternative name found in WIN32_FIND_DATA.cAlternateFileName to create and open the file. Therefore, the full filename is lost.
Thanks for finding that for me Azzmodan!
in case you are wondering why it mattered here's what I was doing:
I've got a batch file which logs into UNIX box via ftp and gets all the files in a particular directory, logs off, list and moves the files and then deletes them next time it connects.
Now, some of the files end in . so the del command was failing and it said file not found because the . had been removed.
If I could do a destructive GET like would be so much easier...
We've now changed the system on the UNIX box to ensure that files never end in .
Here's the .bat files I wrote for this:
getfiles.bat
createList.batCode:if not exist c:\frt\testlist.txt goto firstpass
:here
cd c:\public\faxes
ftp -n -i -s:c:\frt\testlist.txt [IP ADDRESS]
del c:\frt\testlist.txt
echo user [USERNAME] [PASSWORD] > c:\frt\testlist.txt
echo cd [REMOTE PATH] >> c:\frt\testlist.txt
for %%f in (*.*) do call c:\frt\createList.bat %%f
echo mget * >> c:\frt\testlist.txt
rem waiting...
c:\frt\sleep 60
goto here
:firstpass
rem create the file
echo user [USERNAME] [PASSWORD] > c:\frt\testlist.txt
echo cd [REMOTE PATH] >> c:\frt\testlist.txt
echo mget * >> c:\frt\testlist.txt
goto here
here sleep() is a small app just to delay executionCode:echo del %1 >> c:\frt\testlist.txt
move c:\public\faxes\%1 C:\Inetpub\ftproot\frt\fax\%1
hi there,
since i must design a program that just do the thing you are discribing (log in to unix, download the drawingfiles and copy them on a local harddisk...) i'm just wondering i've you could give me a good example in code on how to start.
I'm a newby if it goes into ftp,unix and that stuff. So an example in code as you are describing would be very appriciated...
If you don't want to share the code, i also appriciad that descission.
You always can contact me at
[email protected]
thx in advance
thx mark...