Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Delete a directory and rename a directory

Status
Not open for further replies.

jackps

Technical User
Jul 7, 2003
66
HK
Dear all
I'm a very beginner to AIX / Unix, but i need to restore data from tape to a new create directory.
Can anyone please tell me how i can delete a directory and how i can rename a directory?

many many thanks

Jack
 
I hesitate to do this on a Monday morning but, here goes.

First of all make sure that you have verified that the data on the tape is good and can be restored

If you're happy that it is, cd to the directory above the level of the directory you wish to delete is located and issue an:

rm -r <directory_name>

This will remove the directory and every file and recursive directory within it - these instructions are on the basis that this is what you want to do.

If you know the directory is empty, use rmdir <dir_name> from the level above it.

It's not too clear from your question whether you wish to restore the contents of your tape to another directory. Can you clarify the format the tape's written in (eg tar, cpio etc) and the content in terms of whether the files on it are in absolute (ie with a full pathname) or relative (ie maybe just the filename itself).

 
why dont you just rename the directory using the &quot;mv&quot; command?

see my example below I am goin got rename my directory &quot;stuff&quot; to &quot;mystuff&quot;:

# mv stuff mystuff
#


just a suggestion
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top