Just FYI...
Some better specs on what I need.=20
csh scripts with case and if/then/else logic are needed to be able to
type in a DOS command (with switches) on a UNIX machine and have a UNIX
command / script (with associated switches) give the same info to the
user on the UNIX machine as they would get on a DOS machine.
*Their is NO dos machine/files just dos commands*
A simple example would be dir/w or dir /w (for a wide directory listing).
The closest UNIX command that I know of would be simple: ls -m
But you would have to test for dir/w, dir /w, dir/wp, dir /wp, dir/pw,
dir /pw, dir/p, and dir /p and all for upper/lower case to boot.
Of course the /p is to pause the listing. I guess in UNIX you could do
a ls -m|pg if a /p was used.
=20
Here are the DOS commands with examples and switches of what a UNIX
command would have to duplicate.
*********************************************************************
*********************************************************************
The DIR Command =
=20
=20
Purpose: Displays information about files in a disk directory.
Use to: Check the spelling of a file's name
Make sure that a particular file exists
Find the size of a file
Check the date and time the file was created (or modified)
Usage: DIR [d:][filespec] [/P] [/W]
/P causes the display to pause when the screen is filled. With
DOS 4.0 this will recognize 43- and 5-line screens. See MODE=
=20
/W causes filenames to be displayed in a Wide (5-across) format.
Remarks: You may use wildcard characters to select a subset of files.
When no filespec is given, or when just a pathname is given, DIR
assumes a filename and extension of *.* (ie, all files).
When only the filename is used (ie, DIR myfile) the extension is
assumed to be .* (any extension).
Here's an example screen:
------------------------------------------------------------------------
C>DIR =20
Volume in drive C is HARD DISK <--- volume label (if any)=20
Volume Serial Number is 3C61-1CF2 <--- DOS 4.0 only (ignore it)=20
Directory of C:\ <--- full name of this directory=20
=20
COMMAND COM 45696 2-16-85 12:01a <--- name,extension,size,date,time=
=20
AUTOEXEC BAT 213 6-09-86 12:35p =
=20
UTILS <DIR> 4-07-86 8:01p =
=20
3 File(s) 9152224 bytes free =
=20
C>_ =
=20
----------------------------------------------------------------------
Examples: DIR
With no parameters, DIR assumes all the defaults. It lists all
files in the default directory of the default drive=20
DIR A:
lists all files in the default directory of drive A
DIR c:\dbase /p
lists all files in the \DBASE directory of drive C. The /P mak=
es
the listing pause after each screenful is scrolled.
DIR c:\dbase\*.dbf
lists all files in the \DBASE directory of drive C that have an
extension of .DBF
Hint: DIR does not list hidden files. See CHKDSK /V for a way to do so.
Use the SORT filter to put the listing in alphabetical order.
See Also: File Naming Rules File Commands Paths and Directories=20
=20
=20
*********************************************************************
=20
The COPY Command =
=20
=20
Purpose: Copies a file or group of files from one place to another.
This is the common syntax. See COPY continued... for other optio=
ns.
Use to: Duplicate a file or set of files for backup purposes
Send text data to the printer
Create a standard ASCII text file directly from the keyboard
Usage: COPY [d:]filespec [[d:]filespec] /V
| | =20
source target
Remarks: /V means to verify the copy (see VERIFY ON ).
Any of the reserved filename devices can be a source or target.
If the 'target' filespec exists, it will be overwritten with a
duplicate of the 'source' filespec.
Since COPY is used often, it provides many shortcuts, so you can
save some typing. If you are just getting started, it is best to
use full filenames for both the 'source' and the 'target'. Power
users can take advantages of these short cuts:
=FE Use wildcard filespecs to copy groups of files from one direc=
tory
or drive to another. A wildcard in the 'source' means "copy al=
l
matching files." A wildcard in the 'target' means use the same
name as the 'source'.
=FE When 'target' consists of only a drive ID, the source file(s)=
are
copied to that drive with the same names (as if 'target' includ=
ed
a *.* wildcard)
=FE When 'target' is omitted entirely, the current default drive =
and
default directory on that drive are assumed and the 'source' mu=
st
contain a valid drive ID of pathname.
=FE When the source is a pathname all files in the directory are
copied (*.* is assumed). When the target is a pathname, the
'source' file(s) are copied into that directory.
Examples: COPY myfile.dat myfile.bak
duplicates MYFILE.DAT, naming the copy as MYFILE.BAK
=20
COPY myfile.dat *.bak
same as above, but saves you some typing
COPY A:*.bas C:
copies all files with an extension of .BAS on drive A: to
files of the same name on drive C:
COPY a:*.bas
copies all files with an extension of .BAS on drive A: to
files of the same name on the default drive=20
COPY c:\utils a:
=20
=20
The COPY Command ...conti=
nued
=20
copies all files in directory C:\UTILS to the same names on
drive A. Use this to backup files to floppy diskettes.
COPY a:myfile.dbf c:\dbase
copies MYFILE.DBF from drive A to C:\DBASE\MYFILE.DBF
Hints: To print a text file, copy it to the printer:
COPY c:\pascal\myprog.pas PRN (make a raw printout of the fi=
le)
To quickly create a text file (for instance, a batch file ), copy
from the console to a disk file:
COPY CON c:\autoexec.bat
Just enter the lines of text, then press [F6] or Ctrl-Z after
entering the last line. =20
=20
*********************************************************************
=20
The RENAME Command =
=20
=20
Purpose: Changes the filename and/or extension of a file.
Use to: Give a file a name that's easier to remember
Give an obsolete version of a file a different name
Usage: RENAME [d:]filespec filename[.ext]
or
REN [d:]filespec filename[.ext]
| | =20
current name new name
Remarks: RENAME may be shortened to REN.
Limitations:
The 'new name' must not exist
You can't rename a directory
You can't rename a file's drive or path; the new name must
consist of the filename and extension only.
You can use wildcard characters to save some typing. Any wildcar=
d
character in the second parameter (the new name) will be replaced
with characters from the first parameter (the original name).
Examples: RENAME a:myfile.dat myfile.bak
MYFILE.DAT (on drive A) is given the name MYFILE.BAK
REN current.dat 1986.*
CURRENT.DAT (on the default drive) is given the name 1986.DAT
REN a:*.dat *.bak
All files on drive A that have an extension of .DAT are given an
extension of .BAK
Hints: DOS provides no way to rename a directory; however, you can get
the same effect by creating a new directory with the desired name=
,
copying all files from the old directory into the new, and
deleting the files from, and removing, the old directory:
=20
=20
*********************************************************************
(This is a tuff one. Would probably require a few diff UNIX commands to
make this DOS command work)
The XCOPY Command =
=20
=20
Purpose: Copies files and groups of files and can include files from child=
=20
subdirectories. This is an external command. DOS 3.=
2+=20
Use to: Copy groups of files FAR FASTER than the COPY command.
Backup hard disk files faster than BACKUP (perfect for hard
disk-to-hard disk backup)
Transfer whole directories and entire directory sub-trees from
one hard disk PC to another (via floppy disks)
Copy files selectively by date or modification status
Usage: XCOPY d:filespec [d:][filespec] [/S][/E] [/A or /M][/D] [/P][/W][=
/V]
| | =20
source target
Remarks: Files from the 'source' are copied to the 'target'.
XCOPY assumes the current defaults if any drive or path is omitte=
d.
It assumes *.* if a filename and extension is omitted, however, a=
t
...
read more »