PDA

View Full Version : Braindead ... Need DOS help



SP8's
09-09-2010, 07:59 PM
CAn someone tell me how to find all files with the same file extension from the DOS prompt ... eg All files with .jpg or .wav

I knew it once .. in a time far... far away. got a couple of ** in it somewhere I think. :o

Deimos
09-09-2010, 08:13 PM
dir *.jpg

sub jpg for what ever file type you want it to display.

SP8's
09-09-2010, 08:27 PM
Nope .... dir = Directory doesn't it ?? Tried it on a couple of file types and it comes up with file not found.

icow
09-09-2010, 08:31 PM
Maybe you need the full extension e.g it could actually read .jpg's as .jpeg.

Speedy Gonzales
09-09-2010, 08:32 PM
You probably have to cd to the folder they're in

Deimos
09-09-2010, 08:32 PM
Nope .... dir = Directory doesn't it ?? Tried it on a couple of file types and it comes up with file not found.

:confused:

Works for me.

Just type dir, it should give you a full list of all the files in the directory, CD is for changing directory.

dir (space) *.(file extension)

I don't know what version of DOS you are using but it should be the same since DOS 6, Works in Windows 7 BTW.

Deimos
09-09-2010, 08:34 PM
Maybe you need the full extension e.g it could actually read .jpg's as .jpeg.

No way, DOS doesn't look inside the file, it is purely dependent on what the file extension actually is.

Speedy is probably on the right track, dir won't show files in a sub directory.

SP8's
09-09-2010, 08:35 PM
icow .... nope .... it's in the syntax. I know there's two ** somewhere before you put the .jpg or .wav file extension .... just can't remember what the hell it is.

It's in the brain somewhere, but can't even find it on google .... Am I really getting that old ???

Terry Porritt
09-09-2010, 08:36 PM
The dir command really needs a /S switch so that the current directory and all sub directories are searched. You may need to add a /P switch to pause at each pageful.

So, dir *.jpg /S /P for example


Dir /? from the dos prompt will give you all the switches.

SP8's
09-09-2010, 08:38 PM
Speedy .... want to search a partition for all files with the same file extension and unsure of the directory. I was sure there was a way to do it ... but might be wrong.

SP8's
09-09-2010, 08:43 PM
Terry .... /E for extension

Thanks very much everyone ...... just pressed the reset switch on the back of the head and it all started flooding back

Snorkbox
09-09-2010, 09:52 PM
What worked for me was CMD
CD \
Which put me at the root of C:

Then DIR *.JPG /S /P

Or you can omit the /P and use instead.

DIR *.JPG /S | C:\FileListJPG.TXT

This will give you a text file with the list of jpgs at the root of C:
The vertical character between the /S and C:\ above is called a pipe and is a shifted \ .

This in Win7 64 Pro.

Snorkbox
09-09-2010, 10:12 PM
Yeep. Forget that last bit as the pipe command is NOT in Win7.

feersumendjinn
09-09-2010, 10:52 PM
Maybe this'll help
http://www.computerhope.com/msdos.htm

Snorkbox
09-09-2010, 10:54 PM
Another Edition that does work instead of the PIPE above.

CMD run as admin.
CD\

DIR *.JPG /S > C:\FileListJPG.txt

You get a list of all JPG files on C: in all subdirectories which will be in the root of C:\

You could send the text file to any other valid drive of course.

wainuitech
09-09-2010, 11:28 PM
Also if using W7 run the CMD as administrator, other wise it can throw a big hissy fit and wont run the command ( just tried it)

Snorkbox
09-09-2010, 11:53 PM
Agreed run as Admin as mentioned!!

You can also the above to get a filelist of all files on a drive by using CMD

CD\

D:\

DIR *.* /S > D:\AllFiles.txt

for example.

Paul.Cov
10-09-2010, 07:54 AM
One final tweak, in case the .jpg and .jpeg files are an issue, is the use of the ? wildcard, so you could now use:

dir *.jp? /s

and get a list including all jpg and jpeg files, plus potentially a bit of other stuff as well using an extension starting with jp

SP8's
10-09-2010, 10:17 AM
Thanks for all your help guys. It's going to be a weekend job for a mate .... if he cuts my lawns, does the edges and takes a load of rubbish away ...

mikebartnz
11-09-2010, 12:47 AM
dir *.jp? /s
The ? will bring up everything with .jp and one more character so will not bring up any .jpeg files. You have to use the * character to do that.

Paul.Cov
11-09-2010, 03:07 PM
Oops, that's true. My brain was stuck in a somewhat historic 3-letter extension train of thought. I might have worked once when extensions didn't go over 3 letters, but yes, it needs the two * wildcards when dealing with longer extensions, or yet another twist like this:

Dir *.jp*g /s