Managing folders is much like managing files in Linux. Just remember to use the -r option (recursive) for copying and deleting.
- mkdir newfolder – Creates a folder called folder
- mv newfolder newfolder2 – Renames folder to be folder2
- mv newfolder folder/newfolder – Moves newfolder into the folder directory.
- Warning: You can move AND rename a folder at the same time even by accident.
- cp -r newfolder newfolder.bak – Copies newfolder and contents to newfolder.bak
- -r means “recursive” and so copies both the folder and all contents.
- rm – rf newfolder – Deletes newfolder and all contents
- -f is the “force” option and may be needed if files within the directory are protected for some reason.
Be the first to comment