File and Folder Management CMD

Here’s a concise list of essential file and folder management commands in Command Prompt (CMD) for Windows:


### **Directory Navigation**


- **`cd [directory]`**: Change directory.

  - **Example:** `cd C:\Users\YourUsername`


- **`cd..`**: Move up one directory level.


- **`dir`**: List files and folders in the current directory.


### **Directory Management**


- **`mkdir [directory]`**: Create a new directory.

  - **Example:** `mkdir NewFolder`


- **`rmdir [directory]`**: Delete an empty directory.

  - **Example:** `rmdir OldFolder`


- **`rmdir /s [directory]`**: Delete a directory and its contents.

  - **Example:** `rmdir /s OldFolder`


### **File Management**


- **`del [file]`**: Delete a file.

  - **Example:** `del file.txt`


- **`copy [source] [destination]`**: Copy a file.

  - **Example:** `copy file1.txt D:\Backup\`


- **`xcopy [source] [destination] /s`**: Copy files and directories.

  - **Example:** `xcopy C:\Source D:\Backup /s`


- **`move [source] [destination]`**: Move or rename a file or directory.

  - **Example:** `move file.txt D:\Documents\`


- **`ren [oldname] [newname]`**: Rename a file or directory.

  - **Example:** `ren oldfile.txt newfile.txt`


### **Viewing File Contents**


- **`type [file]`**: Display the content of a file.

  - **Example:** `type file.txt`


- **`more [file]`**: View file content one page at a time.

  - **Example:** `more largefile.txt`


### **File Attributes**


- **`attrib [attributes] [file]`**: View or change file attributes.

  - **Example:** `attrib +r file.txt` (set file as read-only)


### **Searching Files**


- **`dir [filename] /s`**: Search for files in the current directory and subdirectories.

  - **Example:** `dir file.txt /s`


- **`where [filename]`**: Locate files in directories listed in PATH.

  - **Example:** `where file.txt`


These commands should help you manage files and directories efficiently using CMD.