copying files from Unix to Win system

mikeraz at mikeraz at
Mon Jun 24 18:13:13 CDT 2002

On Mon, Jun 24, 2002 at 09:24:24AM -0700, mikeraz at typed:
> Hi All,
> I'm automating a process that receives text files via ftp and then mounts
> a SAMBA share to copy the files to a Windows based file server.
> [snip of how I first did it]
> While I'm scratching my head over why this isn't being done automagically,
> I'm considering:
>    @lines_in_file = <INFILE>;
>    foreach (@lines_in_file) {
> 	chomp;
>    }
>    $/ = "\015\012";  # from newlines in perlport
>    foreach (@lines_in_file) {
>    	print OUTFILE "$_$/";
>    }
> But that feels wrong as in there has to be a better way wrong.

the key was to quit thinking of the file as a collection of lines.

as Charles Radley suggested a s/ / / operation is the key to easing my

   [ open the respective files as IFILE and OFILE ]
   undef $/;
   $slurp = <IFILE>;
   $slurp =~ s/\012/\015\012/g;
   print OFILE $slurp;
   [ close all ]

Handles the translation fine at the expense of assuming that the file fits
into memory  and other such things . . . . 

    Michael Rasmussen  aka  mikeraz
   Be appropriate && Follow your curiosity

   "They that give up essential liberty to obtain
   temporary safety, deserve neither liberty nor safety."
				-- Benjamin Franklin 	

   and the fortune cookie says:
A scientific truth does not triumph by convincing its opponents and
making them see the light, but rather because its opponents eventually
die and a new generation grows up that is familiar with it.
		-- Max Planck

More information about the Pdx-pm-list mailing list