Solved

DIR search not traversing properly

Posted on 2011-02-24
5
258 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 52

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 52

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Are you unable to synchronize your OST (Offline Storage Table) file with Microsoft Exchange Server? Is your OST file exceeding 2 GB size limit? In Microsoft Outlook 2002 and earlier versions, there is a 2 GB size limit for the OST file. If the file …
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

910 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now