Friday, May 15, 2009

Basic File Commands (DOS)

File Manipulation Commands: These manipulate files. Examples are COPY, DEL (delete), TYPE (display file to screen) and, DIR (directory - or list all files in current directory).

In the commands given below, we adopt the convention that anything enclosed in square brackets, [ ], is optional. For example, [x:\path\] refers to an optional device and/or path.

copy [x:\path\]source.ext [x:\path\]target.ext

copies source file to target file.



del [x:\path\]filename.ext

deletes file



move [x:\path\]source.ext [x:\path\]target.ext

moves source to target



type [x:\path\]filename.ext

displays the contents of file to screen. This only works for ASCII text files.



rename [x:\path\]source target.ext

renames file. Note, target must be in same directory as source.



dir [x:\path\filename.ext]

lists all files in directory.

The following commands can be used to create and remove subdirectories and set the default drive and directory. Again anything in square brackets [ ] is optional.

* To change the default drive, at the MS-DOS prompt type the drive letter followed by a colon. For example, to make a: the default drive

C:\> H:

* To change the default path, use chdir or cd, the change directory command. For example, to make FILES, a subdirectory of DOS the default use

C:\Temp> chdir files



To make the root directory the default, use



C:\Temp> cd \

* To make (i.e. create) a directory use mkdir or md, the make directory command. That is

mkdir [\path\]directory





md [\path\]directory

* To remove a directory use rmdir or rd,the remove directory command. That is

rmdir [\path\]directory







rd [\path\]directory



Important! The directory must be empty before you remove it


* To display the directory structure use

tree [drive:\path\]

Creating Directories

My Computer:
1) Open My Computer or Windows Explorer.
2) Open the drive you wish to create a folder on. For example: C:Drive
3) If you do not wish to create a folder in the root directory, browse the location you wish to create a folder on, and then click FILE, then FOLDER, or right click on a blank portion of the folder, click NEW and then FOLDER.

MS-DOS USERS
To create a directory in MS-DOS, use the md/mdkir ms-dos command