home *** CD-ROM | disk | FTP | other *** search
/ Der Mediaplex Sampler - Die 6 von Plex / 6_v_plex.zip / 6_v_plex / DISK5 / DOS_14 / GS252DVX.ZIP / CRLF.BAT < prev    next >
DOS Batch File  |  1992-11-24  |  859b  |  29 lines

  1. # Convert all the files in the current directory from unix to MS-DOS
  2. # line ending conventions.
  3. #
  4. # By Diomidis Spinellis
  5. #
  6. open(FILES, 'find . -print |');
  7. while ($file = <FILES>) {
  8.     $file =~ s/[\n\r]//;
  9.     if (-f $file) {
  10.         if (-B $file) {
  11.             print STDERR "Skipping binary file $file\n";
  12.             next;
  13.         }
  14.         ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime,
  15.  $blksize, $blocks) = stat($file);
  16.         open(IFILE, "$file");
  17.         open(OFILE, ">xl$$");
  18.         while (<IFILE>) {
  19.             print OFILE;
  20.         }
  21.         close(OFILE) || die "close xl$$: $!\n";
  22.         close(IFILE) || die "close $file: $!\n";
  23.         unlink($file) || die "unlink $file: $!\n";
  24.         rename("xl$$", $file) || die "rename(xl$$, $file): $!\n";
  25.         chmod($mode, $file) || die "chmod($mode, $file: $!\n";
  26.         utime($atime, $mtime, $file) || die "utime($atime, $mtime, $file): $!\n";
  27.     }
  28. }
  29.