[an error occurred while processing this directive]

Deleting Files Recursively

Sections
Introduction
The Problem
Deleting Folders Using Unix Commands

Updated: 01/29/06
Download as .pdf


Introduction

Many times there are folders on your dante account that you would like to delete. However, if this folder is not empty, dante will not allow you to delete them unless you go into the folder and delete all the files. Of course, if your folder structure is several layers deep, this can be a tedious task. This document covers how to delete a folder even though it is not empty.

 

The Problem

Let's say for example that you have a folder called to_delete which is not empty. When you try to delete it using SSH Tectia (the SFTP program that comes with the UWICK connectivity kit), you receive and error as shown below in Figure 1.


Figure 1: Error when attempting to delete folder which is not empty

One way around this problem is to go into the folder and delete all of its contents, then go back and delete the empty folder. Of course, if you have folders within folders, this process becomes very tedious very quickly.

 

Deleting Folders Using Unix Commands

The more efficient approach to solving this problem is to use Unix commands to delete the folder.

  1. Use Tera Term to Start a SSH Telnet session and connect to dante.u.washington.edu. This is the program that is included with the UWICK Connectivity Kit and typically is Start > Programs > UWICK Applications > Student Terminal (Dante).


  2. Enter in your username and password. You should see a screen as shown in Figure 2.


    Figure 2: SSH Telnet session connected to dante.u.washington.edu


  3. Press "S" (no quotes) to enter Unix commands. You should now be inside your account.


  4. Type "ls" (no quotes) then enter to list the files and folders in your base directory. If the folder is not in the base directory, you can type "cd folder_name" (no quotes) to change the directory to folder_name.


  5. Once you have navigated to the location of the folder that you would like to delete, type in

            rm -r folder_name

    where folder_name is replaced with the name of the folder that you would like to delete. In our example, we would type "rm -r to_delete" (no quotes). This is shown below in Figure 3. (Enlarge)


    Figure 3: files and folders in current directory and recursively deleting folder (Enlarge)

 

Alison Lum Events
Calum Consulting
[an error occurred while processing this directive]