1757721 Members
2388 Online
108863 Solutions
New Discussion юеВ

Re: remove directory

 
kacou
Regular Advisor

remove directory

A directory (U03)is been created while i configured a logical volume, but i can not remove it. see the error message.

-----------------
ls -s /
drwxr-xr-x 2 root sys 96 Jul 17 09:14 U03
-----------------
error message:
# rm -r /U03
rm: /U03 non-existent
11 REPLIES 11
Steven E. Protter
Exalted Contributor

Re: remove directory

Shalom,

Check the logs.

Either its really not there or you are not giving the correct path.

rm -rf /U03


If you created a logical volume using lvcreate then it will have a path set in the volume group configuration directory.

Lets say I created lvol1 in vg01

The entry for this logical volume is in /dev/vg01 lvol1 and rlvol2

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
James R. Ferguson
Acclaimed Contributor

Re: remove directory

Hi:

If the directory isn't truly non-existent, then its name probably contains unprintable characters. You can do:

# ls -bl /U03

...to see the unprintable characters as octal values

You could do (carefully):

# rm -r /U03*

Regards!

...JRF...
kacou
Regular Advisor

Re: remove directory

after doing the ls -lb / commande i hage got this error mesage.
---------
#ls -lb /
drwxr-xr-x 2 root sys 96 Jul 17 09:14 U\033[2~03

-----------
so what is the command to remove it/
Tim Nelson
Honored Contributor

Re: remove directory

You MUST BE CAREFULL with this as there are a number of invalid chars in your dir name.

ls -l /U*033*
if this returns only your messed up dir
then
rmdir /U*033*
or
find / -name "U*033*" -exec ls -ld {} \;
if this returns only the messed up dir
then
find / -name "U*033*" -exec rmdir {} \;
(I purposefully did not use rm -r)


James R. Ferguson
Acclaimed Contributor

Re: remove directory

Hi:

You could do:

# rm -r /U\033[2~03

Regards!

...JRF...
Robert-Jan Goossens
Honored Contributor

Re: remove directory

Hi,

try the rmdir -i option

# rmdir -i U*

and answer yes to one above U\033[2~03
kacou
Regular Advisor

Re: remove directory

i have another directory U01 and U02.
so doing this command can delete all U* directory
James R. Ferguson
Acclaimed Contributor

Re: remove directory

Hi:

> i have another directory U01 and U02.
so doing this command can delete all U* directory

Yes, if you do:

# rm /U*

...you are asking the shell to expand "U" into every file and/or directory that begins with that letter and then run the remove command on those objects.

I *URGE* you to add the interactive ('-i') option to commands like this *or* to first examine what is going to happpen by doing:

# echo /U*

# rm -i /U*

Regards!

...JRF...
James R. Ferguson
Acclaimed Contributor

Re: remove directory

Hi (again):

I'm sorry, my last answer was wrong for the way your question was worded.

You need to use 'rmdir' to remove a directory. Further, that only removes an *empty* directory. You *can* use 'rm' to remove a directory and all its contents, however, if you add the '-r' flag to descend into the directory (r)ecursively.

Hence, if you do:

# rm -r /U*

...you would remove *all* directories and files that begin with the letter "U". You would be much better advised to first check what's going to happen by first doing:

# echo /U*

and/or adding the '-i' flag:

# rm -r -i /U*

...unless you are very sure of what you are asking.

Regards!

...JRF...