Question

I am doing an FTP PUT request transferring one file to another server. It is just a text file.

The text file I am transferring is formatted ID"TAB"-transID

ftp -ni XX.XX.XXX.XX <<EOF
user ABCD,123456
cd /
put /appl/data/ftp_dpm_412.txt /ftp_dpm_412_$(date +%s).sync


quit
EOF

The receiving party is reporting that the files they are receiving are formatted ID"space""space""space""space""space"-transID. Their system needs the tab.

I have confirmed on my end that the files are indeed formatted as ID"TAB"-transID. (I even ran sed 's/ //g' to ensure I remove all spaces prior to sending it)

Could this be happening when the file transfer is being done? Do I need to add something to my script so that is transfers in a specific mode to prevent this from occurring?

Was it helpful?

Solution

First off, try to confirm what is in the file your remote user has recieved, outside of their normal process. If your remote users can use a Unix/Linux command line and do

head -1 ftped_file.txt | cat -vet

and you should see ^I char sequences, that means that tabs are in the remote file.

This assumes that the first line of text in you file has Tab chars in it. If not, then you need to change head -1 to head -5 or whatever count you need to see lines that have tab chars.


Otherwise, there are 3 places (maybe more) that your file can get changed.

  1. your ftp client. Do man ftp and search for "tab" and/or "space" and confirm there is no option on your client that converts tabs to spaces.

  2. the remote ftp server. You'll have to find the doc for that server and do the same search.

  3. (The most likely place), Your remote client's file viewer? Are they opening this file in a text editor like Ultra-Edit, notepad++ or other? Many of those have a default option to convert tabs to spaces.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top