cygwin rsync and ascii files

David Starks-Browning starksb at ebi.ac.uk
Fri Jun 28 03:44:04 EST 2002


On Thursday 27 Jun 02, michael.protulipac at pncbank.com writes:
> I am ysyncing text files between NT/95/XP machines and Solaris.   I noted
> that the text/ascii files created on the windows platforms contain ^M at
> the end of each line when transfered to the Solaris system.  This can be
> explained by the binary transmission and can use FTP is ASCII mode to
> prevent this from happening.  It is crutial that we preserve the time
> stamp, so running dos2unix isn't one of the top solutions (unless I write
> something to touch the file back to the "original" time).  Is there an
> option to rsync files in ASCII mode?  I would also appreciate and entertain
> other solutions.

I can't think of any way to do this with rsync as shipped.  If you
need to *use* those text files on both Windows and UNIX, is there a
way for you to create them with UNIX line endings in the first place?
The only Windows application I know of that cannot handle UNIX
line-endings is Notepad.

You could try modifying rsync to open text files in text mode on
Windows.  I haven't tried it, but it might strip the ^M for you.  Just
be careful you don't open binary files this way, or they could get
corrupted.  (This approach is probably be too simplistic.)  In any
case, I think your only hope is to modify your copy of rsync to suit
you, possibly in combination with a dos2unix filter on the Windows
side.

There are other techniques to force text v. binary file methods in
Cygwin, using /usr/lib/textmode.o for example.  Figure all that out
using Cygwin docs and resources at <http://cygwin.com/>, not here.

Good luck, I can imagine this feature would be useful to others, so
please keep us informed.

Thanks,
David
(Cygwin FAQ maintainer)





More information about the rsync mailing list