Re: search for a lost directory (Its out there somewhere!!) (118 Views)
Reply
Occasional Advisor
bob the spod
Posts: 22
Registered: ‎02-27-2003
Message 1 of 7 (118 Views)
Accepted Solution

search for a lost directory (Its out there somewhere!!)

Unix peeps

I have lost a directory which I know is called ~omyreally whats the best way to search for it?

Thanks for any help
you make me feel like dancing (gonna dance the night away!)
Honored Contributor
Bill McNAMARA_1
Posts: 3,866
Registered: ‎11-14-2000
Message 2 of 7 (118 Views)

Re: search for a lost directory (Its out there somewhere!!)

Does it really start with ~ ??
or are you referring too your home dir.
As thje user who created the dir
cd
ls -la

(or cd ~omyreally;pwd)
Later,
Bill
It works for me (tm)
Honored Contributor
Martin Johnson
Posts: 2,866
Registered: ‎05-07-2002
Message 3 of 7 (118 Views)

Re: search for a lost directory (Its out there somewhere!!)

Depending on how you "lost" it, maybe fsck will "find" it for you and put it into the lost+found directory.

HTH
Marty
Esteemed Contributor
Bill Douglass
Posts: 316
Registered: ‎09-16-2002
Message 4 of 7 (118 Views)

Re: search for a lost directory (Its out there somewhere!!)

Slow, but exhaustive.

As root:

find / -type d -name \*omyreally\* -print


Where -type d means look for directories by this name.

Also, be aware that sometimes terminal misconfigurations and cause control characters to be entered into file and directory names. Having ^H embedded in a file name can cause problems. In that case, using ls -lRb from a higher level directory will help (recursively list all files and directories, long format, with non-printing characters displayed as /nnn).
Honored Contributor
Michael Steele_2
Posts: 4,934
Registered: ‎08-14-2002
Message 5 of 7 (118 Views)

Re: search for a lost directory (Its out there somewhere!!)

If you know the parent directory, list and search by inode:

ls -i (* will list out unprintable file names *)

find /dir -inum ### -exec ll {} \;
Support Fatherhood - Stop Family Law
Honored Contributor
H.Merijn Brand (procura
Posts: 6,188
Registered: ‎10-13-1997
Message 6 of 7 (118 Views)

Re: search for a lost directory (Its out there somewhere!!)

a5:/u/usr/merijn 101 > perl -MFile::Find -MText::Soundex -le'$x=soundex shift;find(sub{-d||return;$x eq soundex$_ and print$File::Find::name},".")' tnp
./tmp
./.dt/tmp
a5:/u/usr/merijn 102 >

For you that could be

# perl -MFile::Find -MText::Soundex -le'$x=soundex shift;find(sub{-d||return;$x eq soundex$_ and print$File::Find::name},"/")' omyreally

Enjoy, have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Occasional Advisor
bob the spod
Posts: 22
Registered: ‎02-27-2003
Message 7 of 7 (118 Views)

Re: search for a lost directory (Its out there somewhere!!)

found it thanks for those suggestions
im dishing the points out now!

Happy Bob The Spod
you make me feel like dancing (gonna dance the night away!)
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.