Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

# Windows 7: DOS - how to create list of directories without a particular file extn

 22 May 2013 #1 undecided 7 64 4 posts DOS - how to create list of directories without a particular file extn hi, I'm hoping someone can help me perfect a script/batch file etc that will list my folders that do NOT have a particular file extension in it, currently I've been using something similar to the below which would create a list of all directories on the X drive containing jpg files but what I really want is a list of all the folders where I forgot to add the jpg for instance, having to go through the list and comparing to the full folder list to look for differences is too time consuming and often leads to some being missed: X:\>dir x:\*.jpg /w/o/s > \jpglist.txt For example, using the above .jpg extension as an example imagine I had: X:\2009pictures\holiday.jpg X:\2010stuff\work.jpg X:\2011work\reminder.txt X:\2012pictures\holidaysnap.jpg X:\2013\todo.doc I'd like an output text file that says: X:\2011work X:\2013 Since these are the folders that do not contain any jpg files. Really hope someone could help with this, would save me loads of time. I saw an old thread where someone was asking about a similarish type of subject ages ago and got some helpful replies so really hopeful a kind person on here can come to my rescue! DOS - list files in folders without path My System Specs
 .
 22 May 2013 #2 Kaktussoft Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1 10,798 posts SecretCity Code:  dir /b /s x:\|find /v /i ".jpg" Replace x: with actual drive letter My System Specs
 22 May 2013 #3 undecided 7 64 4 posts Quote: Originally Posted by Kaktussoft Code:  dir /b /s x:\|find /v /i ".jpg" Replace x: with actual drive letter hi, thanks for that although that seems to list all files and folders that aren't a jpg so I get hundreds of results for all the other files the drive contains (eg .txt .doc), it also lists all the folders on the drive even if they do contain .jpg files so using my above example it shows the X:\2009pictures folder for instance even though it has a jpg inside. My System Specs
 .
 22 May 2013 #4 Ztruker Windows 10 Pro X64 6,291 posts Space Coast of Florida This will show you only the directories a specific file type is found in, for example *.zip dir \*.zip /n /s | find "Directory of" My System Specs
 26 May 2013 #5 undecided 7 64 4 posts Quote: Originally Posted by Ztruker This will show you only the directories a specific file type is found in, for example *.zip dir \*.zip /n /s | find "Directory of" thanks, I'll make a note of that, could come in useful although what I'm really after is the exact opposite of that - ie list directories a file type is not in. Is there a way of listing all directories and listing all directories that have a file in it and then doing a compare and showing the differences, this would give me the list I need. I was hoping for a DOS command but if it could only be done with vbscript or similar I could live with that, I'd rather keep to stuff that works with standard windows components rather than having to install extra stuff on any PC I used it from but I'd take anything that worked at the moment. My System Specs
 26 May 2013 #6 Layback Bear Windows 7 Pro. 64/SP-1 25,679 posts Northern Ohio I'm no expert but did find this. Could this be what you are looking for. Use at your own risk. My System Specs
 30 May 2013 #7 undecided 7 64 4 posts Quote: Originally Posted by Layback Bear I'm no expert but did find this. Could this be what you are looking for. Use at your own risk. Attachment 269811 sorry for the delay replying everything got a bit hectic for a few days. that FC command looked promising but I can't seem to get it to show the differences. It just displays the contents of each text file one after the other. For example I created a set of folders as a test and only folder2 and folder3 had jpg files inside, I then did the following: dir c:\test\*.jpg /n /s | find "Directory of" > c:\in1.txt (lists folders containing jpg files and outputs to in1.txt) dir c:\test\*.* /n /s | find "Directory of" > c:\in2.txt (lists all folders and outputs to in2.txt) The FC attempt just got the below output, was hoping only differences would be shown, maybe I'm entering it incorrectly?: FC c:\in1.txt c:\in2.txt Comparing files C:\in1.txt and C:\IN2.TXT ***** C:\in1.txt Directory of c:\test\folder2 Directory of c:\test\folder3 ***** C:\IN2.TXT Directory of c:\test Directory of c:\test\folder1 Directory of c:\test\folder2 Directory of c:\test\folder3 ***** Anyone got any idea what's wrong or have other suggestions? My System Specs
 31 May 2013 #8 Ztruker Windows 10 Pro X64 6,291 posts Space Coast of Florida It's the way FC works. Now diff.exe from the Unix Tools for Win32 does exactly what you want. I did the following: dir d:\*.jpg /s /n | find "Directory of" > in1.txt dir d:\*.* /s /n | find "Directory of" > in2.txt diff in1.txt in2.txt -y > out.txt & notepad out.txt That generated a side-by-side output that looks like this: Without any parameter it outputs just the differences, but it puts a offset before each group that I haven't found a way to get rid of yet, looks like this: > Directory of d:\bootwiz > Directory of d:\Canon 1a50,61 > Directory of d:\Canon\CameraWindow > Directory of d:\Canon\CameraWindow\CameraWindowDC > Directory of d:\Canon\CameraWindow\CameraWindowDC\en > Directory of d:\Canon\CameraWindow\CameraWindowDVC > Directory of d:\Canon\CameraWindow\CameraWindowDVC6 > Directory of d:\Canon\CameraWindow\CameraWindowLauncher > Directory of d:\Canon\CameraWindow\MyCamera > Directory of d:\Canon\CameraWindow\MyCameraDC > Directory of d:\Canon\CameraWindow\MyCameraFiles > Directory of d:\Canon\CameraWindow\MyCameraFiles\DefaultSettings121 > Directory of d:\Canon\CameraWindow\MyCameraFiles\DefaultSettings121\OP_WAV > Directory of d:\Canon\CameraWindow\MyCameraFiles\DefaultSettings121\RL_WAV 2a63,66 > Directory of d:\Canon\CameraWindow\MyCameraFiles\DefaultSettings121\SS_WAV > Directory of d:\Canon\CameraWindow\MyCameraFiles\DefaultSettings121\TM_WAV > Directory of d:\Canon\CameraWindow\MyCameraFiles\OP_WAV My System Specs