file size different in unix and windows


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers file size different in unix and windows
# 1  
Old 08-02-2007
file size different in unix and windows

I have a file on solaris/linux.

ls -ls shows the logical size to be: 13292

However, when I transfer the file to my windows machine.. Rightclick->Properties shows the file size as: 13421

I wrote a small program on unix and windows that does a stat() on the file and reports the st_size (file size in bytes) and I get the same result (13292 on windows and 13421 on unix)

Interestingly, this happens only with .txt files. For .pdf and .ppt files, the file size is the same. However, for .txt files the file size on windows is > that on unix.

For another txt file (17MB)
Windows: 18701307 bytes
Unix: 18581191

Does anybody know why is this happening ?

Thanks !
# 2  
Old 08-02-2007
Unix text file end each line with a line feed character.
DOS/Windows text files end each line with a carriage return and line feed.
Because of this, there is one additional character in a DOS/Windows file for each line in the file. Your file contains 13421 - 13292 = 129 lines.
When you transfer the file from Unix to DOS using ascii mode in ftp, this conversion takes place automatically. If you use binary mode, no conversion takes place.
# 3  
Old 08-02-2007
Brilliant ! that explains everything ! Thanks a lot for your help. Smilie
# 4  
Old 08-03-2007
Nice explanation .. Great !
# 5  
Old 08-03-2007
Great jgt...

Nice explanation "jgt"...

Rgds,
Siva.P
# 6  
Old 08-03-2007
different Between the "awk" and "nawk"?

what is the different between the "awk" and nawk" Programme in unix? i have some knowledge in awk concept in unix but i don't know about the "nawk" concept.

Can you any one help me ?

Regards,
Siva.P
Bangalore
# 7  
Old 08-03-2007
Awk is the orignal awk. Nawk is "new awk" - (An enhanced version of AWK, with dynamic regular expressions, additional built-ins and operators, and user-defined functions.) and gawk is the "gnu awk"
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Get size of a file using ls on all UNIX OSes

to get the most granular size of a file, you can do so with: solaris hosts: ls -l /tmp/filea | awk '{print $4}' linux hosts: ls -l /tmp/filea | awk '{print $5}' Is there a more universal command that will give the file size? i'm leery of this ls command because the fields in... (21 Replies)
Discussion started by: SkySmart
21 Replies

2. UNIX Desktop Questions & Answers

Can Unix access Windows' File through Command Prompt in Unix

Hi all, I wish to know whether Unix can access window's file in Unix's terminal? Apart from that, how to copy files or share files between Window and Unix? I get to know of secure copy, however, my company's Unix does not support the feature of secure copy? Any other method for me to share/... (5 Replies)
Discussion started by: jessy83
5 Replies

3. Shell Programming and Scripting

UNIX script to FTP file from UNIX server to windows

Hi, I am new to this subject.....Can someone please help me out with the script... unix usernm "sdhftst" unix pwd "chsd13" windows usernm "dfghtst" windows pwd "chsd13" path..../xxx/xxxxx/xxxxxx/xxxxxxx please can u get me a script...its only one file to get ftp. Thanks... (2 Replies)
Discussion started by: himakiran9
2 Replies

4. Shell Programming and Scripting

Batch job in unix server to move the pdf file from unix to windows.

Hi Experts, I have a requirement where i need to setup a batch job which runs everymonth and move the pdf files from unix server to windows servers. Could some body provide the inputs for this. and also please provide the inputs on how to map the network dirve in the unix like that... (1 Reply)
Discussion started by: ger199901
1 Replies

5. Windows & DOS: Issues & Discussions

Check the file size using Batch script in windows

Hi, I need to check the file size using a batch script. Pls advise. (0 Replies)
Discussion started by: krackjack
0 Replies

6. UNIX for Advanced & Expert Users

how to find the file size in unix

Anybody can help HOW TO FIND THE FILE SIZE IN UNIX (5 Replies)
Discussion started by: lmraochodisetti
5 Replies

7. Filesystems, Disks and Memory

unix file size becomes zero

Hi, when can a unix library file size become zero? For example.: can mistyping this command -> /usr/ucb/ps -auxww|grep -i <process name> make the "ps" library file size to become zero or its contents to get deleted? Is there any other way that an inadvertant mistake could cause the file size to... (1 Reply)
Discussion started by: ananthmm
1 Replies

8. Windows & DOS: Issues & Discussions

checking the size of unix cd on windows platform

Hi, Is it possible or is there a program out there that can get the byte size of a unix cd on the windows platform. Any help would be really great with this. Thanks (2 Replies)
Discussion started by: johnjsm
2 Replies

9. HP-UX

Unix file size - HP-UX

Hi All, Currently we are using HP-UX machine.. We are facing problems with respect to file size. The file size does not seem to be exceeding 2 GB. Could you please let me know the following 1. Is there any difference between a 32 bit application and 64 bit application with respect to file... (2 Replies)
Discussion started by: krishna7
2 Replies

10. UNIX for Dummies Questions & Answers

Hp Unix file size problem

We have two files /var/adm/wtmp and /var/opt/OV/tmp/OpC/guiagtdf Could you please tell me if what these files are and if I can purge them as they are very big and Vi will not let me look at them, it gives me a message 'file to long'. Help any ideas Thanks :cool: (3 Replies)
Discussion started by: A Roberts
3 Replies
Login or Register to Ask a Question