MANIPULATION WITH FILES AND FOLDERS USING COMMAND PROMPT


Although the file explorer in windows works well for the manipulation with the files, occasionally it becomes necessary to create, execute, delete and move files using a command prompt. This could be necessary due to a specific issue with the windows file explorer or a more deep-rooted problem with windows itself. Regardless of the issue, there are a few basic commands that can help when using command prompt in this capacity.




                Commands

1.  cd/chdir:-  change directory. cd/ brings you to the root directory. cd.. goes up one level. chdir doesn’t parse file paths with spaces in the name


2.copy:-This command copies a specified file to a given location. The syntax for the command is copy followed by the original file location, followed by the path that you want the file to be copied to.
here in given shot the file autorun.bat from jee mains directory copied to new folder named as amarendra which is residing in local disk drive E 

3. Delete the files:-

 syntax:-del 

del is used to delete one or more files.
here in jee mains directory autorun.bat is deleted 
Note:- if the name of the file have spaces then the quotes should be added with a file name

4. Delete all the files having the same extension.

syntax:- del "*.extension"

this syntax is used for deleting all the files having the same given extension.
for example, here all the jpg files in the directory will be deleted.

5. Delete all the files in the directory.

syntax:- del  *

Sometimes our system doesn't respond or in other words, it goes hanged due to existence of the virus in files  and then tries to delete all the files in the directory but it is unable to execute the deletion operation it that case cmd  is a very effective tool to operate deletion operation 

  


  6. How to go back to the previous directory 


syntax:- cd  . .

  if we want to go back to previous directory then we uses cd . . 
here  command (cd . . )closes the jee mains directory

 7.  BASICS OF TREE (Display Directory)



Syntax:
TREE [d:][path] [/A][/F]


Purpose: Displays directory paths and (optionally) files in each subdirectory. 

Discussion

When you use the TREE command each directory name is displayed along with the names of any subdirectories within it. The display will be in a format like the summary below. (Different versions of DOS may display the data in a slightly different format.)

First, the root directory and the directories within it are listed (directory names listed in a five column display):

DIRECTORY PATH LISTING FOR VOLUME (volume name)

Path is C:

Then each directory within the root is listed:

Path is: C:\(directory name)



8. USE OF Deltree COMMAND

       Short for delete tree, deltree is a command used to delete files and directories permanently from the computer.


Comments