Solved

DIR search not traversing properly

Posted on 2011-02-24
5
259 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
  • 2
  • 2
5 Comments
 
LVL 53

Accepted Solution

by:
Bill Prew earned 500 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 53

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Sometimes people don't understand why download speed shows differently for Windows than Linux.Specially, this article covers and shows the solution for throughput difference for Windows than a Linux machine. For this, I arranged a test scenario.I…
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
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…

825 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