Command Prompt File Management Made Easy

Below you will find a list of common and useful Command Prompt commands for managing files and folders. It includes short commands for copying, moving, renaming, deleting, creating, and listing files and folders, as well as changing directories and displaying the contents of a file.

The commands are presented in an accessible and user-friendly format with examples of how to use each one. The document serves as a quick reference guide for users who need to perform basic file manipulation tasks using the Command Prompt. If a command fails to run, running Command Prompt as Administrator is required.

1. Copy:

copy <source> <destination>

Example:

copy C:\example\file.txt D:\backup\file.txt

2. Move:

move <source> <destination>

Example:

move C:\example\file.txt D:\backup\file.txt

3. Rename:

ren <existing_file> <new_file>

Example:

ren file.txt newfile.txt

4. Delete:

del <file>

Example:

del example.txt 

This command will delete the file named example.txt in the current directory. Make sure to use this command with caution as deleted files cannot be recovered.

Here’s an example of using the del command with the /f option to force delete a file in Command Prompt:

del /f example.txt

This command will force delete the file named example.txt in the current directory, even if it is marked as read-only.

5. Remove Directory:

rd <folder>
rmdir <folder>

Example:

rd C:\example\folder
rmdir c:\FolderToDelete 

To delete a folder with its subfolders and contents using the Command Prompt, you can use the rd command with the /s option:

rd /s examplefolder
rmdir /s examplefolder
rmdir c:\FolderToDelete /s 

This command will delete the folder named example folder in the current directory, including all its subfolders and contents. Make sure to use this command with caution, as deleted files and folders cannot be recovered.

You can also use rmdir to force delete a folder including subfolders.

rmdir c:\FolderToDelete /s /q 

6. Create a Folder:

md <folder>

Example:

md C:\example\newfolder

7. List Files and Folders in a Directory:

dir

Example:

dir

8. Change Directory:

cd <directory>

Example:

cd C:\example

9. Display the Contents of a File:

type <file>

Example:

type file.txt

10. Find Files:

dir /s /b <file_name>

Example:

dir /s /b file.txt

Note: Use the commands with caution!

Make sure to use the commands with caution as they can permanently delete or modify your files and you may not be able to recover them.

Leave a Reply

Your email address will not be published. Required fields are marked *