DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

doscmd(C)


doscmd: doscat, doscp, dosdir, dosformat, dosmkdir, dosls, dosrm, dosrmdir -- manipulates DOS files and filesystems

Syntax

doscat [ -r | -m ] file ...

doscp [ -r | -m ] [ -v ] file1 file2

doscp [ -r | -m ] file ... directory

dosdir directory ...

dosformat [ -fqv ] drive

dosls directory ...

dosrm file ...

dosmkdir directory ...

dosrmdir directory ...


NOTE: Refer to the next section for details of the file and directory arguments to these commands.

Description

The doscmd commands provide access to the files and directories on MS-DOS floppy disks and on DOS partitions of a hard disk. Note that in order to use these commands on a DOS 4.0 partition the DOS volume label must be non null and the DOS serial number must be set. In order to use these commands on a DOS 3 partition the DOS volume label must be non null. It is also possible to mount and access a DOS filesystem while operating from the UNIX system partition.

The doscmd commands perform the following actions:


doscat
Copies one or more DOS files to the standard output. If -r is given, the files are copied without newline conversions. If -m is given, the files are copied with newline conversions (see ``Conversions'').

doscp
Copies files between a DOS disk and a UNIX filesystem. If file1 and file2 are given, file1 is copied to file2. If a directory is given, one or more files are copied to that directory. If -r is given, the files are copied without newline conversions. If -m is given, the files are copied with newline conversions (see ``Conversions''). When copying from a DOS disk to the UNIX filesystem, the -v option writes the names of the newly created files to the standard output.

See the section ``Using wildcards'' for details of how doscp handles regular expressions.


dosdir
Lists DOS files in the standard DOS style directory format.

dosformat
Creates a DOS 2.0 formatted diskette. The drive may be specified in either DOS drive convention, using the default file /etc/default/msdos, or using the UNIX system special file name. dosformat cannot be used to format a hard disk. The -f option suppresses the interactive feature. The -q (quiet) option is used to suppress information normally displayed during dosformat. The -q option does not suppress the interactive feature. The -v option prompts the user for a volume label after the diskette has been formatted. The maximum size of the volume label is 11 characters.

dosls
Lists DOS directories and files in a UNIX system format (see ls(C)).

dosrm
Removes files from a DOS disk.

dosmkdir
Creates a directory on a DOS disk.

dosrmdir
Deletes a directory from a DOS disk.

The file and directory arguments for DOS files and directories have the form:

device:name

where device is a UNIX system pathname for the special device file containing the DOS disk, and name is a pathname to a file or directory on the DOS disk. The two components are separated by a colon (:). For example, the argument:

/dev/fd0:/src/file.asm

specifies the DOS file, file.asm, in the directory, /src, on the disk in the device file /dev/fd0. Note that slashes (and not backslashes) are used as filename separators for DOS pathnames. Arguments without a device: are assumed to be UNIX system files.

For convenience, the user configurable default file, /etc/default/msdos, can define DOS drive names to be used in place of the special device file pathnames. It can contain lines with the following format:

A=/dev/fd0
C=/dev/dsk/0sC
D=/dev/dsk/0sD
K=/dev/dsk/1sC

The drive letter ``A'' may be used in place of special device file pathname /dev/fd0 when referencing DOS files (see ``Examples''). The drive letters ``C'' or ``K'' refer to the DOS partition on the first or second hard disk, and ``D'' refers to a logical drive in the extended partition on the first hard drive.

The commands operate on the following kinds of disks:

DOS partitions on a hard disk
5 ¼ inch DOS
3 ½ inch DOS
8, 9, 15, or 18 sectors per track
40 or 80 tracks per side
1 or 2 sides
DOS versions 1.0, 2.0, 3.0, 3.3 or 4.0

Conversions

In the case of doscp, certain conversions are performed when copying a UNIX system file. Filenames with a basename longer than eight characters are truncated. Filename extensions (the part of the name following separating period) longer than three characters are truncated. For example, the file 123456789.12345 becomes 12345678.123. A message informs the user that the name has been changed and the altered name is displayed. Filenames containing illegal DOS characters are stripped when writing to the MS-DOS format. A message informs the user that characters have been removed and displays the name as written.

When using doscp to copy files from a DOS disk to a UNIX filesystem, the default action is to force conversion of filenames to lowercase if the destination filename is not specified.

All DOS text files use a carriage-return/linefeed combination, CR-LF, to indicate a newline. UNIX system files use a single newline LF character. When the doscat and doscp commands transfer DOS text files to the UNIX system filesystem, they automatically strip the CR. When text files are transferred to DOS, the commands insert a CR before each LF character.

Under some circumstances the automatic newline conversions do not occur. The -m option may be used to ensure the newline conversion. The -r option can be used to override the automatic conversion and force the command to perform a true byte copy regardless of file type.

Accessing DOS filesystems from the UNIX system partition

The ability to mount DOS filesystems is an extension of the DOS utilities documented here. (See mount(ADM) and mnt(C) for details of how to mount a DOS filesystem.) There are several limitations within the DOS directory structure which make this a difficult task.

In short, the DOS filesystem does not associate as much information with each file as the UNIX system filesystem does. Therefore, allowances and assumptions have to be made for information that would be present under the UNIX system but that does not exist under DOS.

The DOS directory structure contains the following information:

Using this information, it is converted to a UNIX system inode. There are some UNIX system provisions which cannot be carried over, because the filesystem must remain sane under DOS.

These commands cannot be used with mounted DOS filesystems. If an attempt is made to access a mounted DOS filesystem using the DOS utilities the message:
   command: filesystem is mounted.
   This command does not work with a mounted DOS filesystem.
is printed on the standard error output and the command returns an exit value of 1.

Accessing UNIX filesystems with DOS utilities

If an attempt is made to access a mounted UNIX system filesystem using the DOS utilities the message:
   command: devicename is mounted
is printed on the standard error output and the attempt fails. If possible, the command continues to operate on the remaining parameters and returns a value of 1. Upon normal completion, these commands return a value of 0.

DOS file conversion

The utilities xtod(C) and dtox(C) can be used to convert the EOL sequences used to and from DOS, respectively.

Using wildcards

The DOS utilities allow the use of the following wildcard symbols within DOS filenames:

?
for matching a single character

*
for matching zero or more arbitrary characters

When copying from DOS to UNIX:

Full shell regular expressions may be used with UNIX pathnames. See regexp(M) for further details.

Examples

Note that the forward slash character (/) must be used as the directory separator character when dealing with DOS filesystems under UNIX. This is at variance with the usual DOS practice of using the backslash (\) character as the directory separator character. For example,

doscat /dev/fd0:/docs/memo.txt

is used instead of the DOS path syntax, which would be

doscat a:\docs\memo.txt

Other examples of doscmd commands are:

doscat /tmp/f1 /tmp/f2 /dev/fd0:/src/file.asm

doscp /tmp/myfile.txt /dev/fd0:/docs/memo.txt
doscp /tmp/f1 /tmp/f2 /dev/fd0:/mydir

dosdir /dev/fd0:/src
dosdir A:/src A:/dev

dosformat /dev/rfd0135ds18

dosls /dev/fd0:/src
dosls B:

dosrm /dev/fd0:/docs/memo.txt
dosrm A:/docs/memo1.txt

dosmkdir /dev/fd0:/usr/docs

dosrmdir /dev/fd0:/usr/docs

Limitations

These commands cannot be used with mounted DOS filesystems.

When copying large files, it is quicker to use the cp(C) command with a mounted DOS filesystem than to use the doscp command.

The programs mentioned above cooperate among themselves so no two programs will access the same DOS disk. Only one process will access a given DOS disk at any time, while other processes wait. If a process has to wait too long, it displays the error message, ``can't seize a device'', and exits with an exit code of 1.

You cannot use the dosformat command to format device A: explicitly. Device A: is aliased to /dev/install, which cannot be formatted. Specify the drive as /dev/fd0 instead.

The Development System supports the creation of DOS executable files, using cc(CP). Refer to the C User's Guide and C Library Guide for more information on using your UNIX system to create programs suitable for DOS systems.

All of the DOS utilities leave temporary files in /tmp. These files are automatically removed when the system is rebooted. They can also be manually removed.

Files


/etc/default/msdos
default information

/dev/fd*
floppy disk devices

/dev/dsk/
hard disk devices

See also

assign(C), dtox(C), dtype(C), mkfs(ADM), mnt(C), mount(ADM), regexp(M), xtod(C)

``Working with DOS'' in the Operating System User's Guide, ``Going from DOS to UNIX'' in the Operating System Tutorial

Standards conformance

doscat, doscp, dosdir, dosformat, dosls, dosmkdir, dosrm and dosrmdir are not part of any currently supported standard; they are extensions of AT&T System V provided by The Santa Cruz Operation, Inc.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003