Using DOS command you can use various operations such as copying, rename, move, delete etc. of a file. In a file operation a file name can be A to Z letters, 0 to 9 numerical values. Generally, you can’t use the following names as file name.
DOS command in file operation
CLOCK, CON, AUX, COM1, COM2, COM3, COM4, LPT1, LPT2, LPT3, LPT4, NUL, PRN.
Also in same directory you cant have same file name having same extension. During the rename of the file you can use upper or lower case letters as you wish.
Generally by observing the file extension we can determine what type of file it is. For example, if a file contains the extension of .txt, then we can easily realize that this is a file containing text document. In DOS file some of the extensions and their explanations are,
.EXE – It indicates a program file.
.COM – Indicates a program file also.
.BAT – The file which contains the list of a command (the list is followed by the DOS later)
.INI – For having run a program, the primary command is included in this type of file.
Now lets have some file operation using DOS
Copying a group of files using wild card
Let you have 5 files in a drive D having same extension (for example .doc extension). You want to copy that all files to drive E. Just use this command,
Copy D:\ *.doc E:\
Rename a file during copy
Suppose that you want to copy a file and rename it with a new name while saving in the new directory. Just use this command.
Copy D:\ name.doc E:\newName.doc
If you want you can rename the file in a same directory using this dos command. just use this command,
Copy D:\name.doc D:\newName.doc
Also can use REN command to rename a file. Use this command,
REN old.doc new.doc
>>If you want to delete a particular file from a directory, then can use, DEL command.
This command will delete name.doc file from D directory.
>>Let you are staying E directory and you want to delete a file from that E directory. Then don’t need to indicate that directory path, just type,
>> Lets you want to delete a group of file (having same extension). For example, you want to delete the files having .tmp extension in directory D.
If you want to see the list of files you want to delete, then may use DIR command.
If there are so many files and you want to see files one by one, then may use,
>> Now lets think that, you want to delete .doc files which name starts with N. Then use,
Now lets think that you want to delete some files in which the second letter is N. Then,
Leave a Reply