Searching files.

J

John Fitzsimons

It seams to me that searching .exe .tmp etc files is a waste of time.
So I am thinking that I might use a freeware search program that
allows searching of ONLY certain file extensions.

My first query however is "What file extensions are currently on my
computer ?"

Is there a way to list all existing file extensions that I have ?
ONCE. A program ? Utility ? Batch file ?

Suggestions ?

Regards, John.
 
R

rir3760

It was a dark and stormy night when John Fitzsimons <DELETEucwubqf02
@sneakemail.com said:
It seams to me that searching .exe .tmp etc files is a waste of
time. So I am thinking that I might use a freeware search program
that allows searching of ONLY certain file extensions.

My first query however is "What file extensions are currently on
my computer ?"

Is there a way to list all existing file extensions that I have ?
ONCE. A program ? Utility ? Batch file ?

What you want to accomplish is (relatively) easy to do using console
applications (cat, sed, sort and uniq). If you don't have them you
can get them as part of either the UnxUtils or Cygwin packages.

UnxUtils homepage:
<http://unxutils.sourceforge.net/>
Cygwin homepage:
<http://www.cygwin.com/>

Using Cygwin on Windows 98 the steps required are as follows:

First open a DosBox and switch to the root directory:

cd "C:\"

Then, to get a list of all files in drive c, type:

dir /s /b /a-d>FileList.txt

Next step is to remove the path (e.g. 'c:\dir1\dir2\filename.ext' =>
'filename.ext'):

cat FileList.txt|Sed -ne "s/^.\+\\\\\(.\+\)$/\1/pi">FileList2.txt

Now we delete all the characters up to the last '.' (e.g.
'filename.ext' => 'ext'), sort the file (using sort.exe) and remove
any duplicates (using uniq.exe):

Sed -ne "s/^.\+\.\(.\+\)$/\1/pi" FileList2.txt|sort|uniq>FileList3.txt

A good advice is to try the above and once is working OK you can
automate the process using a batch file.

Hope this helps
 
J

John Fitzsimons

It was a dark and stormy night when John Fitzsimons <DELETEucwubqf02
@sneakemail.com> wrote:
What you want to accomplish is (relatively) easy to do using console
applications (cat, sed, sort and uniq). If you don't have them you
can get them as part of either the UnxUtils or Cygwin packages.

Okay, but it isn't at all clear from that page whether Cygwin is
needed or not. Or for which utilities.

The download link only appears to give options such as "install
from the internet" etc.
Using Cygwin on Windows 98 the steps required are as follows:

When I got to the "default textfile type" I wasn't sure whether I
should choose DOS or Unix. So didn't bother. I haven't time to jump
through hoops trying to work out which emulation, programs, etc. I
need to play with to get a relatively straightforward task done with.
First open a DosBox and switch to the root directory:
Then, to get a list of all files in drive c, type:
dir /s /b /a-d>FileList.txt

Okay, that I can do without even thinking of Unix or Cygwin.
Next step is to remove the path (e.g. 'c:\dir1\dir2\filename.ext' =>
'filename.ext'):
cat FileList.txt|Sed -ne "s/^.\+\\\\\(.\+\)$/\1/pi">FileList2.txt

Thanks, but will try a "search and replace" with a windows program.
Once I can work out if/how your syntax needs changing.

< snip >

Thanks for your help. I will try and do as you have outlined but using
a windows program.

Regards, John.
 
S

slippery

It seams to me that searching .exe .tmp etc files is a waste of time.
So I am thinking that I might use a freeware search program that
allows searching of ONLY certain file extensions.

My first query however is "What file extensions are currently on my
computer ?"

Is there a way to list all existing file extensions that I have ?
ONCE. A program ? Utility ? Batch file ?

Suggestions ?

Regards, John.

if you are using windows here are some suggestions.

open a explorer window and find 'Folder Options' in the drop
down menus. (XP- Tools -> Folder Options)
click on the 'File Type' tab for a complete list of all file
types your PC is aware of.

two great search programmes are

AVA FIND
http://www.think-less-do-more.com/avafind/
great for file type and filename searching.

Wilbur version 2.1 latest patch to V2.1B16 (now with pdf
file capability)"
http://wilbur.redtree.com/index.htm
for searching through TXT DOC HTML PDF... Pretty much any
file with text in it.

HTH
slippery
 
C

charles

First open a DosBox and switch to the root directory:

cd "C:\"

Then, to get a list of all files in drive c, type:

dir /s /b /a-d>FileList.txt

Next step is to remove the path (e.g. 'c:\dir1\dir2\filename.ext' =>
'filename.ext'):

cat FileList.txt|Sed -ne "s/^.\+\\\\\(.\+\)$/\1/pi">FileList2.txt

Now we delete all the characters up to the last '.' (e.g.
'filename.ext' => 'ext'), sort the file (using sort.exe) and remove
any duplicates (using uniq.exe):

Sed -ne "s/^.\+\.\(.\+\)$/\1/pi" FileList2.txt|sort|uniq>FileList3.txt

I got curious about your sed expressions. Couldn't parse them and they
didn't work for me. Following snip does (watch the wrap):

dir /s /b /a-d|sed -ne "s/^.*\.//gpi" filelist.txt|sort|uniq
filelist.txt

note - not ignoring case of ext
 
C

charles

dir /s /b /a-d|sed -ne "s/^.*\.//gpi" filelist.txt|sort|uniq

note - not ignoring case of ext

Oops!

dir /s /b /a-d|sed -ne "s/^.*\.//gpi"|sort|uniq >filelist.txt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top