The Command Line Part 2
Week 1 — The command line
Creating and deleting directories (folders) To create a directory (in other words a folder) ensure you have navigated to the correct location and use the command “mkdir” (this is the same for Mac and PC). Example “mkdir new_folder_name”.
Removing a file is just as easy however the terminal commands are slightly different compared to windows. In terminal use the command “rm” followed by the file name. In Windows command prompt use the command “del” followed by the file name (remember to include the extension of the file type!)
Removing a directory is equally as simple using the command “rmdir” Example “rmdir new_folder_name”.

Removing directories that contain files requires an extra step, if you were to attempt using rmdir on an empty folder it would work as expected, however if the folder did contain something it would not. To delete a folder and it’s content use the switch command “ rm -r ”, example “rm -r folder_name”, for windows its “rmdir /s”, following this you’ll receive a prompt “Are you sure” Y/N, enter Y for yes N for no.
Other ways of deleting files, that’s right there’s more! One additional method is “rm -i” (remove interactively) this will prompt you to confirm that you want to delete each file one by one within your selected directory. In windows you could selectively delete delete a specific file type if you wished to do so using “del /S *.jpg”. Perhaps you have a file you need to force delete, in terminal you would use the command “rm -f”, where in windows it would be “del /f”. As you can gather there multiple ways of doing the same thing.
