Operating System - HP-UX
1822040 Members
3472 Online
109640 Solutions
New Discussion юеВ

Removing hidden files from a directory

 
DipuK
Occasional Contributor

Removing hidden files from a directory

Hi,
When I try to delete all files from a directory with wild character, the hidden files are not removed. How can this be done.

I know I can delete the hidden files explicitly by giving the name. But I don't want this to be done. I want some command with wild chars

Cheers!!!!!
Dipu
5 REPLIES 5
Michael Steele_2
Honored Contributor

Re: Removing hidden files from a directory

cd /dir
ls -i (* note inode number *)
find . -inum #### -exec rm {} \;
Support Fatherhood - Stop Family Law
Robert-Jan Goossens
Honored Contributor

Re: Removing hidden files from a directory

Hi,

you mean .files
# rm -- .*files

Robert-Jan.
eran maor
Honored Contributor

Re: Removing hidden files from a directory

Hi

this is tricky thing to do .

first you can do ls -q to see hidden char in this files .

after that you can try to do rm "*" -i to confirm the delete ( remember to use it or you will delete all files ) .

and you can also check this reply that help me that i had problem with this issue :

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x838a107d277ad611abdb0090277a778c,00.html

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x962436e69499d611abdb0090277a778c,00.html


love computers
James R. Ferguson
Acclaimed Contributor

Re: Removing hidden files from a directory

Hi Dipu:

# cd yourdir
# rm .[!.]* .??* *

The three regular expressions following the 'rm' should remove everything but the "." and the ".." directories.

Regards!

...JRF...
Bill Douglass
Esteemed Contributor

Re: Removing hidden files from a directory

rm .??*

This avoids the . and .. entries, and deletes everything else.