Searching for files and directories


6 posts
by Markodius » Fri Jan 25, 2013 6:59 pm
Hi,

How do I search for a particular file or directory? Currently what I do is manually look in each location hoping to spot something that wasn't there before I ran the automatic install. Quaint but hardly efficient! Surely there is a better way of which I am ignorant?
"We are the Mysterons and we know you can hear us"
― The Mysterons
Posts: 115
Joined: Fri Jan 04, 2013 11:14 pm
by jamesh » Fri Jan 25, 2013 8:23 pm
You can use the find command if you know the name of the file you are looking for.

Code: Select all
find . -name fred.txt


The . mean current directory, so that will look in the current directory and all it's subfolders for the file fred.txt. You can also use wildcards in the name. Check out the man page and you can also limit the search by date, size etc, which might give you what you are looking for (i.e. all files changed recently)
Volunteer at the Raspberry Pi Foundation, helper at Picademy September, October, November 2014.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12372
Joined: Sat Jul 30, 2011 7:41 pm
by Markodius » Fri Jan 25, 2013 8:38 pm
Thanks Jamesh. That will save some time!
"We are the Mysterons and we know you can hear us"
― The Mysterons
Posts: 115
Joined: Fri Jan 04, 2013 11:14 pm
by nr. » Fri Jan 25, 2013 9:02 pm
jamesh wrote:You can use the find command if you know the name of the file you are looking for.

Code: Select all
find . -name fred.txt


The . mean current directory, so that will look in the current directory and all it's subfolders for the file fred.txt. You can also use wildcards in the name. Check out the man page and you can also limit the search by date, size etc, which might give you what you are looking for (i.e. all files changed recently)


I think you'll need one of the unix utility packages installed for that - I'm pretty sure it's not a RISC OS command. Certainly I don't have it installed on my machine.

The way I find a file is to middle click on the suspected folder (don't forget, apps are also folders) and then choose Dir (or App)->Find and enter the filename. Say, for example that you want to find something that has been installed in the !Boot structure, right-click on !Boot, choose "App.!Boot'" then "Find" then type in the filename you're looking for. Wildcards are accepted.
--
nr.
Posts: 141
Joined: Wed Oct 03, 2012 8:51 am
Location: The Fens
by jamesh » Fri Jan 25, 2013 9:33 pm
Oops. Sorry, didn't take note of the forum title when I posted - my comments was very much linux based I'm afraid.
Volunteer at the Raspberry Pi Foundation, helper at Picademy September, October, November 2014.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12372
Joined: Sat Jul 30, 2011 7:41 pm
by Markodius » Sat Jan 26, 2013 2:36 am
No worries.. I have found a lot of stuff by dint of looking! but it certainly helps to know how to find something you know must be there. I really liked Raspbian - picked up my hard drives and had no trouble formatting whatsoever or storing and streaming data after booting from them. I found that she handled much more nimbly than I'd thought possible when installed to magnetic - not as fast as my desktop but plays multimedia video way better than my desktop. Truly impressive.
"We are the Mysterons and we know you can hear us"
― The Mysterons
Posts: 115
Joined: Fri Jan 04, 2013 11:14 pm