"~" comes in filename after file copy

I have a windows n/w share mapped to a unix path.

I am trying to copy the file from one unix location to this location using "cp" command.

After I copy the copy and check the filename logging through unix, I can see it as expected. But, when I check the file from Windows at the n/w share, the filename is corrupted with some strange alphabets followed by "~".e.g.: FRPOU00~.txt or RCRTU45~.txt. The data in the file is all consistent, just the filename is the issue...

It should be something like file1.txt or file2.txt. I can see the correct names for those files when connected through unix.

One thing to note here is the file size is about 1GB.

Any help appreciated....

I think those are short 8.3 DOS names and the Unix names somehow do not get translated into the longer Windows names.....
What software and methods are you using on either platform to facilitate the sharing?

Sorry..but can you be more specific about what you mean software/methods being used?

I am just using a "cp src_dir/file.txt tgt_dir/file.txt" command....

Point to be noted here is, I have 4 files out of which 2 files are small files(arnd 400MB) which are copied with no issues.. Only the big 2 files(arnd 1GB) are having the issue...

Also, the smaller files have longer filenames compared to big files and still those are copied successfully...

Lets get some background information here:

  • What kind of UNIX, and what version?
  • What version of Windows?
  • Are the Unix installation and the Windows installation on the same machine? If not, how are files shared between them (FTP, WebDAV, SFTP, SMB/CIFS, NFS, ...)?

I seem to recall some kind of compatibility setting. Windows 3.1 used filenames 12345678.123 format. Thus, a long filename such as 1234567890.123 would become 1234567~.123
However, your second comment about "size" of the file also has me intrigued. Coincidence? Can you tell us
original-filename original-filesize final-filename
So we can rule some things in/out of the mix.

original-filename : Transaction_File_1.txt
original-filesize: 961MB
final-filename :FRPOU00~.TXT

Point to be noted here is the other file which is smaller in size(419MB) has a longer filename(Transction_summary_file1.txt) and is still copied correctly.

Also, for the file having issue, I can see the correct final filename when I login through Unix but shows this distorted name when I go through windows.

I am a newbee in this area...Can you pls tell me the commands to run to provide you the neccessary info?

1) For unix... are you connecting to Solaris, HP, other ??
Also, type

uname

as the command to find out about your unix version.
2) Are you using Windows 7, Windows XP, or ?? for your PC

We can start with those two.

Uname command gives output "LINUX"

and I am connecting to windows n/w share with Windows XP on my machine.

The ~ version of filenames when displayed in MSDOS 8.3 notation is to handle filenames which might not be unique when truncated. This gets progressively more complicated the more similar filenames you have:

To see both versions at a CMD prompt use "dir /X":

dir /X my_very_long*

18/02/2011  23:55                 7 MY_VER~1.TXT my_very_long_filename.txt
18/02/2011  23:55                 7 MY_VER~2.TXT my_very_long_filename2.txt 

Obviously we need to know what Operating Systems you have and what you typed.