Knowledge Base

Enter search queries below or use the tag links to the right to browse the knowledge base by category (Show All Tags).


How do I send a PGP encrypted file to a UNIX server so that the CR characters are stripped from the data?

DOS/Windows systems use different line endings in text files than Unix and Unix-like systems. The former uses a CR-LF pair to terminate lines of text while the latter uses just LF.

The FTP protocol offers "ASCII mode" so users can have the line endings in text files converted automatically to whatever is appropriate for the target system.

However, this only works if you are uploading a plain text file. If you want to send the file encrypted, you must handle the line ending conversion manually before encrypting the file.

To upload a text file to a Unix server with the correct line endings you will first need to strip the CR characters from the file, encrypt the file, then send the file using binary mode.

To strip the CR characters from the data you will need to use a 3rd party executable. Go to http://www.bastet.com/ and download the file "UDDU.ZIP". Unzip the executable "DOS2UNIX.EXE" into your Robo-FTP install directory -- by default this is "C:\Program Files\Robo-FTP". You can use this executable in your Robo-FTP script to convert the file to UNIX format before encrypting.

For example, if you wanted to remove the CR characters from the file "plain text.txt", encrypt the file, then send it you would do something like the following:

EXEC 'DOS2UNIX.EXE "plain text.txt"'
PGPENCRYPT "plain text.txt" "plain text.txt.pgp" /user="my key"
SENDFILE "plain text.txt.pgp" /type=bin

NOTE: The /user option was deprecated in Robo-FTP 3.10. Users of Robo-FTP 3.10 and later should use the /encryptfor option instead. See the Help file for details.

Article last updated: 2021-11-05

Tags: ASCII, PGP, UNIX