Polaris: How Do I Remove Directories?

Polaris: How Do I Remove Directories?

To conserve disk space, you should periodically delete the files/folders you no longer need. You can use the rmdir command to delete an empty directory and the rm command with the –Ri options to recursively delete a directory and its content. The –Ri options asks you if you would like to view the files in the directory, displays each file and ask if you want to delete it. After the last file is deleted, you are asked if you want to delete the directory. . For information on deleting files, please see Polaris: How Do I Remove Files. To use the rm and rmdir commands to remove directories from your Polaris account:

Step 1

From the directory you are working in, type:

Polaris> ls –l

and press [ENTER] to list the content of your current directory. The above command contains two lowercase L's and has a space between ls and -l

In the example to the right, there are two directories and three files. Directories will have a "d' as the first character in the line. In this example, classwk and homework are directories, while the other three are files.

Step 2

At the Polaris prompt, type the rmdir command followed by the directory name.

If the directory is empty, it will be deleted and a Polaris> prompt returned.

If it contains files, it would tell you the directory is not empty and not delete it. To delete directories as well as all the files inside it, see Step 2 below

If you try to delete a directory that contains files you would see something similar to: à

Step 3

To delete a directory that contains files we recommend you use the rm command, followed by the –Ri options and the directory name to "recursively" delete the directory and its content.

This asks you if you would like to like to view the files in the directory, displays each file and ask if you want to delete it. After the last file is deleted, you are asked if you want to delete the directory. See the example to the right: