How to check a file whether it is in binay mode or not while doing ftp??

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to check a file whether it is in binay mode or not while doing ftp??
# 1  
Old 01-30-2008
How to check a file whether it is in binay mode or not while doing ftp??


One bank statement file should be loaded into some tables by using a concurrent program. But if the file is transfered in binary mode i am getting some special characters in the file which is unexpected. so, for that while moving that file data into tables i want to write a script that checks whether the file is in binay mode or in Ascii mode?? If it is transfered in binary mode, then i want to display one error message that the file should not be transferred in binary mode.

I think my explanation is clear.

can any one let me know what is the command to check whether the file is in binary mode??

Thanks in advance.
# 2  
Old 01-30-2008
Why not run the file through dos2ux (dos2unix on some machines). If the file is "binary" it will get changed automatically. IF not, it won't be touched.
# 3  
Old 01-30-2008
Just a comment,
I think it's a bad habit of most ftp-implementations to default to converting data between systems, ie ASCII transfer. I would rather always transfer the data in binary, exactly, or at least as closely as possible, as it is represented on "the other" system, and make the conversion myself. I know what it looks like on one system and and I know how I want it on another. It is better to control it Yourself than letting someone else (the ftp-client) to convert it the way it thinks it should be, because that may differ between clients and methods.
I think You will find that binary mode transfers don't add or change anything in Your data. It is ASCII-mode that usually converts line breaks, character sets between platforms, etc.

Then again, ASCII may be the way You want it or expect it...

file is a command to check the type of file, it may not always be completely accurate. The FTP-definition of binary is not shared by all...

and as jim pointed out, running it through dos2unix, shouldn't hurt, as long as it's "text" data, it could actually wreak havoc in some data files, such as xml CDATA, or sql with "binary" BLOBS.

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

After Ftp'ing file to destination how to check the file if it is in correct ASCII and not corrupted

Hi Folks, While transferring file from FTP software like Filezilla the files gets corrupted. Is there any way I can check if the recently transferred file is in ASCII and not corrupted. I have tried using file -i filename command which does tell if the file character set is ASCII or binary... (6 Replies)
Discussion started by: Khan28
6 Replies

2. Shell Programming and Scripting

FTP file check help

hello i need check if file_name exist on remote FTP or not the FTP is anonymous and doesnt require username/pass (3 Replies)
Discussion started by: mogabr
3 Replies

3. AIX

ftp connect in passive mode , ftp settings

how to connect to ftp server in passive mode? ftp and how can i see ftp settings, doesn't exist some ftpd.conf there is some other file where i check the options and configurations of ftp server? Thanks (3 Replies)
Discussion started by: prpkrk
3 Replies

4. Shell Programming and Scripting

File permission check in SFTP mode

Hi, I have requirement to get a file from a remote location using SFTP only if the file has read/write permission either to the user or to the group. Currently i m taking the ls of the required file and storing it in a flat file to check the file permission. Please advice is there any... (3 Replies)
Discussion started by: ravin
3 Replies

5. Shell Programming and Scripting

change the mode of the file after FTP

Hi I am FTPing a file to a remote server from my local server. But after I FTP it the permissions are not in executable option, I need to change the permissions of the FTPed file how can i do that. Below is my script LOCALDIR=/batch/ediprocess LOCAL_BACKUP_DIR/batch/ediprocessBackUp... (4 Replies)
Discussion started by: shanth_chandra
4 Replies

6. Shell Programming and Scripting

Check file, before FTP

:mad: Hi All, I have written a script, which will get the file from other server through FTP. It is working fine, but i want to add a code which should first check, if the file is available in the source system and then do FTP, once successfully completed, it should delete the file. Is... (4 Replies)
Discussion started by: Amit.Sagpariya
4 Replies

7. Shell Programming and Scripting

file check before FTP

Hi I use a shell script to transfer files from UNIX to Windows 2000 server before the FTP i need to check whether any files with the same name exists. If the files are already present it need not be FTPed else the file should be FTPed. Kindly help me. (2 Replies)
Discussion started by: Codesearcher
2 Replies

8. UNIX for Advanced & Expert Users

Using FTP to check whether file is completely FTP... plz find the description below

Hi, We have some clients who will place huge files in to one of the remote server. And the shell script written in our local server to retrieve client files (using FTP) placed on one of the remote server of ours by clients. My question Is there any FTP command/script to check from my local... (1 Reply)
Discussion started by: nmsrao
1 Replies

9. Shell Programming and Scripting

how could I check whether ftp a file is successfully done or not

how could i check that the ftp oof any file is successfully done. thanks in advance. (1 Reply)
Discussion started by: rinku
1 Replies

10. IP Networking

Transfering file through FTP through Binary Mode

Hi, I'm uploading files using internet explorer. 1.Open internet explorer 6.0 2.Open site like 3.Copy files The files which I'm copying are basically zip files. What is the default transfer mode, I mean ASCII/BINARY ???. The problem I'm facing, while extracting these... (4 Replies)
Discussion started by: ronald_brayan
4 Replies
Login or Register to Ask a Question