www.digitalmars.com [Home] [Search] [CTG] [RTL] [IDDE]

Last update Feb 2, 2003


CHMOD: Read/Write File Attributes

chmod changes or displays the attributes for a particular file.

Command syntax:

	chmod {(+|-)attribute} [file...] 
file is the file or files of interest. Wildcards are accepted.

Using + before an attribute turns on the attribute. Using - turns off the attribute. The attributes are:

R Read only
H Hidden
S System
V Volume label
D Subdirectory
A Archive
Example: This line makes myfile.exe a read-only file:
	chmod +R myfile.exe 
If no attributes are specified, chmod displays (but does not change) the file's attributes, in this form:
	__A__SHR 0x27 IO.SYS 
Mnemonic characters denote attributes that are "on"; underscored characters indicate that an attribute is "off." Thus, chmod can be handy for finding hidden and system files:
	chmod *.*

DIFF: Compare Files

diff compares two text files and displays any lines that are different.
	diffdir switches... file1 file2
switches:
-c
Show context around differences
-e
Set off differences with <<>>
-i[macro]
Set off differences with #if macro/#else/#endif
-w
Ignore trailing whitespace when comparing lines

DIFFDIR: Compare Directories

diffdir recursively compares the contents of two directory trees. Files are compared by reading the files and comparing them byte-for-byte. All files, including hidden and system files, are compared.
	diffdir switches... dir1 dir2
switches:
-v Verbose
The output of the program will list files that are different from dir1 to dir2, prefixed by a character:
- File exists in dir1 but not in dir2.
+ File exists in dir2 but not in dir1.
# File exists in both dir1 and dir2, but has different contents.
It's useful for:

FLPYIMG: Read/Write Floppy Image

flpyimg will read, write, and verify entire floppy disk images, or just the boot sector. It's useful for backing up boot floppies, or for preparing boot floppies with a custom operating system.

Reading a floppy image from drive: and writing it to file:

	flpyimg switches... drive: file
Reading a floppy image from file and writing it to drive:
	flpyimg switches... file drive:
-b Boot sector only, not the entire disk.
-h Help
-v Verify that file matches disk contents.

Examples

Read the entire contents of disk a: and write it to the file foo.img.
	flpyimg a: foo.img
Read the first 512 bytes of boot.img and write it to the boot sector of disk b:.
	flpyimg -b boot.img b:
Read the entire contents of disk b: and verify that it matches the file foo.img.
	flpyimg -v b: foo.img

Notes


WHEREIS: Search For Files

whereis searches a directory tree or the entire disk for specified files.
	whereis filespec
Searches the entire disk for files matching filespec. filespec can contain ? and * wildcards.
	whereis directory filespec
Recursively searches directory and all its subdirectories for files matching filespec. filespec can contain ? and * wildcards.
Copyright © 1995-2003 Digital Mars. All Rights Reserved.