?
Solved

DIR search not traversing properly

Posted on 2011-02-24
5
Medium Priority
?
262 Views
Last Modified: 2012-06-22
Maybe I'm old-school, but I do a good bit of searching with the classic DIR /A/B/S, but today it doesn't seem to be working right.

Specifically, there was a folder on our server at U:\shared\elementary that is gone. Before I go pulling backups, I'd like to see if someone has (accidentally?) moved it. This:
U:\shared>dir /s/a/b elementary. 

Open in new window

shows a folder in a subdir called "elementary," but it's not the one I'm looking for. Next stop is running the same command at the root, but since there's another folder named "elementary" in the root (also not the right one,) the list is huge. So I try to slim it down with:
U:\>dir /s/a/b elementary. | find /v /i "u:\elementary"

Open in new window

But that gives me ZERO results, when I know good and well that there's a folder named "elementary" in a subdir of "shared." Running the command on the root with the find pipe omitted
(and outputting to a logfile) doesn't show the one I know about either. So obviously I can't trust these results!

Any idea what's going on here?
0
Comment
Question by:LSDIT
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 57

Accepted Solution

by:
Bill Prew earned 2000 total points
ID: 34970914
I would think you want DIR /AD rather than just DIR /A, but I don't think that will resolve the problem.

Your command looks reasonable in general, although I wouldn't put the period after the directory name.

If you use Windows GUI tools to search for that folder, does it find it?  If not, then maybe it's a permissions issue?

~bp
0
 

Assisted Solution

by:LSDIT
LSDIT earned 0 total points
ID: 34971300
I don't know about the gui... using XP's silly search dog does a search for *elementary* and I don't know how to disable that.

And yeah, I'm used to using the dot to distinguish folders, but I suppose /ad is better. DIR /A without specified attributes lists files with any attributes, I believe.

I really can't see it being a rights issue, seeing as how I'm running the "search" as the same user (who is, incidentally, a domain admin) both times.

AHA!!

I figured it out. All the switches were stopping me from seeing the base command, which is "DIR ELEMENTARY". Of course, if there is a folder NAMED "elementary" in the current dir, it will list the contents of THAT folder, so it was running the command on THAT folder.

This works, forcing a search:
U:>dir /s/b/ad elementar?

Open in new window


Thanks for the help!
0
 
LVL 57

Expert Comment

by:Bill Prew
ID: 34976034
Welcome, glad my comment was of some use, thanks.

~bp
0
 
LVL 38

Expert Comment

by:BillDL
ID: 34977695
I know the question is in the process of being closed, so this is just for additional info and I am NOT seeking to squeeze into any points split.

I sometimes use the WHERE.EXE (version 5.0.1774.1) command line program from an earlier version of Windows on my XP system.  If you have an old Win98se CD lying around, look in the folder:
CD:\tools\reskit\file\
for where.exe and copy it to your C:\Windows or C:\Windows\System32 folder, first making sure that there isn't already a program of that name in either of those folders.  I don't think I would be allowed to attach a copy of it here for you.  It would be interesting to see if you find it to be a useful tool.

I generally use it with wildcards and redirect output to a text file for use in some other process or to examine for a particular purpose.  Here are all the switches:

WHERE [/r dir] [/qte] pattern ...

/r - recurse starting with directory dir
/q - quiet, use exit code (note lowercase q)
/t - times, display size and time
/e - .EXE, display .EXE type
/Q - double quote the output (note uppercase Q)

Examples:

WHERE notepad.exe                 Find ALL notepad.exe along the path
WHERE $windir:notepad.exe    Find ALL notepad.exe along %windir%
WHERE /r \ notepad.exe           Find ALL notepad.exe on current drive
WHERE /r . notepad.exe           Find ALL notepad.exe recursing on current directory
WHERE /r c:\windows\system notepad.exe   Find ALL notepad.exe recursing on c:\windows\system

Wildcards, * ?, allowed in bar in all of above

Note: if spaces are present in path or file names searched for, double-quote the path or filename in your command.
0
 

Author Closing Comment

by:LSDIT
ID: 35005236
Figured it out myself, but his comment helped me to do that.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Migration of Exchange mailbox can be done with the ExProfre.exe tool. But at times, when the ExProfre.exe tool migrates the Exchange Server user profile, it results in numerous synchronization problems. Synchronization error messages appear in the e…
Issue: Unstable cursor in Windows XP and Windows runs extremely slow in that any click will bring up the Hour glass (sometimes for several seconds before giving you what you want) . Troubleshooting Process and the FINAL FIX: This issue see…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question