dosread Command

Purpose

Copies DOS files.

Syntax

dosread-a ] [  -v ] [ -D Device ] File1 File2 ]

Description

The dosread command copies the DOS file specified by the File1 variable to standard output or to the file specified by the File2 variable. If no pathname is specified for the File2 variable, the DOS file is copied to the root directory.

Unless otherwise specified, the dosread command copies the number of bytes specified in the directory entry for the file specified by the File1 variable. This means, in particular, that you cannot copy directories because, by convention, directories have a record size of 0.

You can use DOS file-naming conventions with one exception: the \ (backslash). Because the \ character can have special meaning in DOS, use a / (slash) character as the delimiter to specify subdirectory names in a DOS path name. The dosdir command converts lowercase characters in the file or directory name to uppercase before it checks the disk. Because all file names are assumed to be full (not relative) path names, you need not add the initial / (slash).
Notes:
  1. The dosread command does not interpret the * and ? (asterisk and question mark) wildcard characters as having special meaning. If you do not specify a file-name extension, the file name is matched as if you had specified a blank extension.
  2. You cannot customize the name of this command. The command must be named dosread.
  3. The dosread command reads files from the default drive containing the DOS diskette. The dosread command then copies the files to the current directory as a file recognized by this operating system. If the DOS diskette contains subdirectories, the dosread command does not create corresponding new subdirectories in this operating system. You must create the subdirectory and specify each DOS file you want to copy into the new subdirectory.

Flags

Item Description
-a Replaces each CR-LF (carriage return, line-feed) key sequence with a new-line character and interprets a Ctrl-Z (ASCII SUB) key sequence as the end-of-line character.
-DDevice Specifies the name of the DOS device as /dev/fd0 or /dev/fd1. The default value of the Device variable is /dev/fd0. This device must have the DOS disk format.
-v Writes file information to standard output about the format of the disk. Use this flag to verify that a device is a DOS disk.

Examples

  1. To copy a text file from a DOS, type:

    dosread  -a chap1.doc chap1

    This command sequence copies the DOS text file \CHAP1.DOC on default device /dev/fd0 to chap1 in the current directory.
  2. To copy a binary file from a DOS diskette, type:
    dosread -D/dev/fd1 /survey/test.dta /home/fran/testdata
    This command sequence copies the DOS data file \SURVEY\TEST.DTA on /dev/fd1 to /home/fran/testdata.
  3. To copy every DOS file on a diskette, type:
    dosdir | awk '!/There are/ {print $1}'|xargs -t -i dosread {} {}
    This command sequence takes files from the default drive containing the DOS disk and copies them to the current directory.

Files

Item Description
/usr/bin/dosread Contains the dosread command.
/dev/fd0 Contains the device name for a diskette drive.