Deleting a Directory


 
Thread Tools Search this Thread
Operating Systems AIX Deleting a Directory
# 1  
Old 02-18-2016
Error Deleting a Directory

I have a directory under my home directory called: my work. I cannot delete this directory and I want to.

If anyone needs additional information. Please let me know.

Any help you can provide is greatly appreciated.
# 2  
Old 02-18-2016
Any error messages? What are the permissions of the directory and its parent?
# 3  
Old 02-18-2016
As a wild guess, I would say that instead of using the command:
Code:
rmdir my work

you need to use the command:
Code:
rmdir "my work"

but, without seeing what you tried, what error messages you received, knowing whether or not the directory you're trying to remove is empty, knowing the permissions of the directory to be removed and the permissions of its parent directory and the effective user and group IDs you are using when you try to remove that directory; any guess is just wild speculation.
# 4  
Old 02-18-2016
Actually we have a whole treatise about what to do in such a case. You might want to read it.

I hope this helps.

bakunin
# 5  
Old 03-04-2016
For the record: I was taking a class to on Linux/Unix commands and they showed us how to make directories with spaces and special characters. Here is the error I get when trying to remove the directory:

Code:
:/home/Hippie13>rmdir "my work"
rmdir: my work not removed.
No such file or directory

Thank you all again for your help. Smilie

Last edited by Nerdgirl1313; 03-09-2016 at 12:16 PM.. Reason: Add CODE tags.
# 6  
Old 03-04-2016
Try
Code:
rmdir -i *"my work"*

# 7  
Old 03-04-2016
Can we see the output from these two
Code:
ls -li "*my*work*"
ls -li "*my*work*" | od -x

The output from the latter will be larger hex dump of the characters returned and that should help us see if there are any other odd characters in the file, perhaps a leading or trailing space in the the name or some other undisplayable character.

You may even get away using the following from the output of the first command:-
Code:
find . -xdev -inum i-node -exec rmdir {} \;

You will need to insert the i-node number from the output of the ls -li It's usually in the second column. If you are worried, you can run this first to check you get the right directory.:-
Code:
find . -xdev -inum i-node -exec echo rmdir {} \;


Does this help you at all?



Robin
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Deleting directory with leading hyphen in name

I asked this question last month in Stack Exchange (linux - delete directory with leading hyphen - Server Fault) and none of the answers supplied worked. I have somehow created a directory with a leading hyphen and cannot get rid of it. # ls -li | grep p 2621441 drwxr-xr-x. 2 root root... (4 Replies)
Discussion started by: edstevens
4 Replies

2. Shell Programming and Scripting

Deleting 3 days old logs from a directory

As i am working in unix environment so i have an logs that is created by my application at the following location that is /opt/app/glac/current/servers/ops/logs inside the logs directory there are different kinds of logs(that is the file having extension as .log ) have been created... (1 Reply)
Discussion started by: 2015nks
1 Replies

3. UNIX for Dummies Questions & Answers

Deleting a directory and zipping another directory

Hi Folks, I have a directory in unix that is /usr/local/pos contain the folowing directoreis ..that is dir1 dir2 dir3 now I want to delete only dir2 please advise how to remove the directory dir 2 ..that is rm command and how to use it , and second if I want to zip the dir3 please... (1 Reply)
Discussion started by: punpun66
1 Replies

4. Shell Programming and Scripting

Excluding directory during deleting

Hi all, I'm trying to work on a script to delete files older then 31 day's in certain directories. Now, that works, but in one directory there are 3 other maps which contains files that can be deleted but one map which contains files that can't be deleted. My current command is: find... (6 Replies)
Discussion started by: JasperG
6 Replies

5. SCO

Deleting a directory that is not empty

I know someone will probably laugh at this question, I probably knew the answer many years ago when I was doing this full time but here goes..... I have a directory that has many files and sub-directories in it, RMDIR will not delete a directory that is not empty so what is the command to... (1 Reply)
Discussion started by: moondogi
1 Replies

6. Shell Programming and Scripting

Deleting the file only to all the directory and sub directory

I need the unix command or shell script to delete all the file in current directory and sub directory. (7 Replies)
Discussion started by: kingganesh04
7 Replies

7. Linux

deleting only directory not files

Hi Guys, I want to know wheather it is possible to delete directory not files, Example: In one directory there are 10 dirs and 100 files but my req is to delete only dirs not file Wheather it is possible ? (13 Replies)
Discussion started by: manoj.solaris
13 Replies

8. Shell Programming and Scripting

deleting empty files in a directory

Hello Gurus, I want to delete only empty files (files with 0 bytes) at once from the local directory. Rightnow I need to go through all the files one by one manually and check the empty files before deleting them. Is there any unix command that finds and deletes empty files in a directory?... (5 Replies)
Discussion started by: berlin_germany
5 Replies

9. UNIX for Advanced & Expert Users

Accidentally deleting directory/files

Hi, I accidentally deleted a big directory with all its sub-directories and bunch of source code files which I have been developing for about 2 years... What will I do now, how can I retrieve my files, directory hierarchy back ??? If anyone, please HELP ! ! ! ... (4 Replies)
Discussion started by: milhan
4 Replies

10. UNIX for Dummies Questions & Answers

Deleting A Directory!

This must be simple! How do you delete a directory that contains other files and directories?:confused: (2 Replies)
Discussion started by: firefinger
2 Replies
Login or Register to Ask a Question