How to Create a Directory or Folder?
Creating folders, subfolders, directories, and subdirectories is an important task in managing files on a computer. The process of creating a folder or directory may differ depending on the operating system you are using. Here's how you can create a folder or directory in each major operating system:
Creating a folder in Microsoft Windows
In Microsoft Windows, there are several methods to create a new folder depending on where you want it to be located.
- My Computer or Windows Explorer.
- Windows desktop.
- Create a new folder using a keyboard shortcut.
- Windows command line.
1) My Computer or Windows Explorer
Here are the step-by-step instructions for creating a new folder in Windows Explorer/File Explorer:
- Press the Windows key + E to open Windows Explorer/File Explorer. This will bring up a new window where you can navigate to the location where you want to create the new folder.
- On the left side of the window, select the drive or folder where you want to create the new folder. For example, you can select the C: drive, or you can create a folder in the root directory.
- Once you have selected the location for your new folder, you can create a new folder in the following ways:
- Windows 11: Click the New option in the menu bar and select Folder in the drop-down menu.
- Windows 8 and 10: On the Home tab, click the New folder icon.
- Windows 7 and earlier: In the file menu bar, click File and select Folder in the drop-down menu.
- After selecting the option to create a new folder, a new folder icon will appear in the current directory. You can name the folder by clicking on the default name (usually "New Folder") and typing a new one.
- Once you have named the folder, press Enter to save it. Your new folder will now appear in the selected location, ready for you to use.
2) Windows Desktop
To create a new folder in Microsoft Windows, follow these steps:
- Navigate to the Windows desktop using the keyboard shortcut Windows key + D.
- Once you're on the desktop, right-click on any blank portion of the screen.
- In the menu that appears, click on "New" and then select "Folder."
- A new folder icon will appear on your desktop, and the folder name will be highlighted. Type a name for the folder and then press Enter.
- The new folder will now appear on your desktop, ready to be used.
You've successfully created a new folder on your Windows desktop.
3) Create a new folder using a keyboard shortcut
You can use a keyboard shortcut to create a new folder in Windows Explorer without using the mouse. Here are the steps:
- Open Windows Explorer by pressing Windows key + E.
- Navigate to the folder or directory where you want to create the new folder.
- Press Ctrl + Shift + N on your keyboard.
- A new folder icon will appear in the current directory, and the folder name will be highlighted.
- Type a name for the folder and then press Enter.
- The new folder will now appear in the directory, ready to be used.
And that's it! You've successfully created a new folder in Windows Explorer using a keyboard shortcut.
4) Windows Command Line
Here's how you can create a directory in the Windows command line:
- Open the Windows command line by pressing the Windows key+R on your keyboard, typing "cmd" in the Run dialog box, and then pressing Enter.
- Navigate to the directory where you want to create the new directory using the cd command. For example, to navigate to the C:\Users\YourUsername\Documents directory, you would type "cd C:\Users\YourUsername\Documents" and then press Enter.
- Once you are in the correct directory, type "mkdir" followed by the name of the directory you want to create. For example, to create a directory called "NewFolder," you would type "mkdir NewFolder" and then press Enter.
- The new directory will now be created in the current directory.
And that's it! You've successfully created a new directory using the Windows command line.
Creating a directory in MS-DOS and Windows Command Prompt
To create a directory in MS-DOS or the Windows Command Prompt (cmd), use the md or mkdir command. Below are some examples:
- To create a new directory called "hope" in the current directory:
mkdir hope
- To create multiple new directories in the current directory with the md command:
md user1 user2 user3
- If you want to create a directory with spaces, surround the directory name with quotes. For example:
md "my example directory"
- To create a directory in the parent directory without moving to that directory, use the following command:
md ..\example
- This will create an "example" directory one level up.
- To create a subdirectory in a different directory without moving to it, use a command like the example below. This command creates a "test" directory in the "hope" directory.
mkdir hope\test
- To create a directory in another drive without moving to that drive, use a command like the example below. This command creates an "example" directory on the F: drive.
md F:\example
You can now create directories in the MS-DOS or Windows Command Prompt using the md or mkdir command.
Create a directory with a batch file.
To create a new folder using a batch file, simply include the appropriate command for creating the folder, such as md or mkdir. Here's an example of a simple batch file that creates a new directory:
@echo off
md NewFolder
In this example, the md command is used to create a new directory called "NewFolder". The @echo off command is included at the beginning of the batch file to prevent each command from being displayed as it is executed.
You can also include additional commands in the batch file to perform other actions, such as changing directories or copying files. Here's an example that creates a new directory and copies a file into it:
@echo off
md NewFolder
copy C:\Documents\Example.txt NewFolder\
In this example, the copy command is used to copy a file called "Example.txt" from the "C:\Documents" directory into the new "NewFolder" directory.
Once you've created your batch file, you can run it by double-clicking on the file in Windows Explorer. This will execute the commands in the batch file and create the new directory.
Creating A Directory in Linux, Unix, and their Variants
In Linux, Unix, and other variants, the mkdir command is used to create a new directory.
The basic syntax for creating a new directory in the current directory is simply:
mkdir directory_name
For example, to create a new directory called "hope" in the current directory, you would enter:
mkdir hope
If you want to create a directory with a specific path, you can include the full path as an argument to the mkdir command. For example:
mkdir /home/user/Documents/hope
This would create a new directory called "hope" inside the "Documents" directory of the "user" account's home directory.
If you need to create multiple directories at once, you can list them all as arguments to the mkdir command. For example:
mkdir directory1 directory2 directory3
You can also use the ‘-p’ option to create a directory and any necessary parent directories that do not yet exist. For example:
mkdir -p /home/user/Documents/hope/files/documents
This would create a directory called "documents" inside a new directory called "files", which is inside a new directory called "hope", which is inside the "Documents" directory of the "user" account's home directory. The ‘-p’ option creates any parent directories that don't already exist.
Creating a folder and directory in Microsoft Windows 3.x
In Microsoft Windows 3.X, you can create a folder and directory using the following steps:
- Click on the "File" menu in the Program Manager window.
- Select the "New" option, and then choose "Folder" from the submenu.
- A new folder icon will appear on your desktop. You can rename the folder by right-clicking on the icon and selecting "Rename" from the context menu.
- To create a directory, open the MS-DOS prompt by clicking on the "MS-DOS Prompt" icon in the Program Manager window.
- Use the "cd" command to navigate to the location where you want to create the directory.
- Type "md" followed by the name of the directory you want to create, and press Enter.
For example, if you want to create a directory called "MyDirectory" in the C:\MyFolder\ subdirectory, you would do the following:
- Click on the "File" menu in the Program Manager window.
- Select the "New" option, and then choose "Folder" from the submenu. Rename the folder to "MyFolder".
- Open the MS-DOS prompt by clicking on the "MS-DOS Prompt" icon in the Program Manager window.
- Type "cd C:\MyFolder" and press Enter to navigate to the MyFolder subdirectory.
- Type "md MyDirectory" and press Enter to create the new directory.
Your new directory will now be located in the C:\MyFolder\MyDirectory\ subdirectory.
Creating a folder in macOS
1) Desktop folder
Creating a new folder on the macOS desktop. Here is a summary of the steps:
- Navigate to the macOS desktop.
- Right-click (tap two fingers on the trackpad or multi-touch mouse) any blank space on the desktop to bring up the contextual menu.
- From the contextual menu, select "New Folder."
- A new folder will appear on the desktop with the name "untitled folder." Type a name for the folder and then press Return.
- The new folder will now have the name you assigned to it, and you can drag and drop files or other folders into it as needed.
2) Create a Folder in a Directory
Here are the steps to create a new folder in a directory using Finder on a Mac:
- Open Finder and navigate to the directory where you want to create the new folder.
- Click on the "File" menu in the top menu bar.
- Select "New Folder" from the drop-down menu that appears. Alternatively, you can use the keyboard shortcut Command + Shift + N to create a new folder.
- A new folder icon will appear in the directory you selected, with the name "untitled folder" selected. Type a name for the folder and then press Return to finish creating the folder.
- The new folder will now be located in the directory you selected, and you can add files or other folders to it as needed.
How to delete a file, directory, or folder.
Here are the detailed steps to delete a file, directory, or folder on different operating systems:
Windows:
- Navigate to the file, directory, or folder you want to delete using File Explorer.
- Right-click on the file, directory, or folder that you want to delete.
- Select "Delete" from the context menu that appears, or press the "Delete" key on your keyboard.
- If you are deleting a file, you will be asked if you want to move the file to the Recycle Bin or permanently delete it. If you are deleting a directory or folder, you will be asked if you want to permanently delete it. Choose the appropriate option.
- If you choose to move the file to the Recycle Bin, it will be stored there temporarily and you can restore it if necessary. If you choose to permanently delete the file, it will be removed from your computer immediately and cannot be recovered.
MacOS:
- Navigate to the file, directory, or folder you want to delete using Finder.
- Click on the file, directory, or folder that you want to delete to select it.
- Press the "Delete" key on your keyboard, or right-click on the item and select "Move to Trash" from the context menu.
- If you select "Move to Trash," the file, directory, or folder will be moved to the Trash folder on your Mac. If you want to permanently delete the item, right-click on the Trash icon in the Dock and select "Empty Trash" from the context menu. This will permanently delete all items in the Trash folder.
Linux:
- Navigate to the file, directory, or folder you want to delete using the terminal or file manager.
- Open a terminal window and type "rm" followed by the file, directory, or folder name. For example, to delete a file called "myfile.txt", you would type "rm myfile.txt" in the terminal.
- Press Enter to execute the command. If you are deleting a directory or folder, you may need to add the "-r" option to the command to delete the directory and all its contents. For example, to delete a directory called "myfolder", you would type "rm -r myfolder" in the terminal.
- If you run the command successfully, the file, directory, or folder will be deleted permanently and cannot be recovered.
Note: Always be careful when deleting files, directories, or folders, as they will be permanently deleted and cannot be recovered from the Recycle Bin or Trash. Make sure to double-check before you delete something, and always have a backup of important files.