Link to home
Start Free TrialLog in
Avatar of itsquad
itsquadFlag for United States of America

asked on

Can I query a windows folder to select a specific list of files in search results?

I have 26,000 pictures in one folder called "Images".  Each picture contains each product's item code in it.  I'd like to query the Windows folder "Images" to give results of a pre-determined list of item codes - say that are in a referring table.  Is this possible?  Of course the query would have to use a wild-card search...
example:
Item Code = 081124555435
Picture Name = 081124555435xactual.jpg

So I'll need to pull batches of around a 100 pictures for many different product types many times - all with different item codes.

Of course I can do one by one with a copy paste, but I'm almost 50 now and I feel I may not have that much time left on the planet!  :D

Update: I actually have the exact name of the file I want for each item.  
Here's a sample list of those:
IMAGEORIG
683274011097xactual.jpg
761294017814xactual.jpg
761294015193xactual.jpg
761294012857xactual.jpg
761294008522xactual.jpg
761294008508xactual.jpg
749699161806xactual.jpg
717669414139xactual.jpg
691991202186xactual.jpg
691991201400xactual.jpg
691991201370xactual.jpg
691991200496xactual.jpg
52252274xactual.jpg
683274011158xactual.jpg
761294020937xactual.jpg
683274011066xactual.jpg
52201113xactual.jpg
683274010939xactual.jpg
683274010786xactual.jpg
683274010755xactual.jpg
683274010731xactual.jpg
683274010618xactual.jpg
683274010595xactual.jpg
683274010496xactual.jpg
683274010137xactual.jpg
614252064309xactual.jpg
606559309184xactual.jpg
691991200465xactual.jpg
761294081440xactual.jpg
4959112057647xactual.jpg
52200200xactual.jpg
5226933xactual.jpg
06300194xactual.jpg
800315032952xactual.jpg
761294500071xactual.jpg
761294413302xactual.jpg
761294413296xactual.jpg
761294407127xactual.jpg
761294403570xactual.jpg
761294403563xactual.jpg
761294403556xactual.jpg
761294017838xactual.jpg
761294083840xactual.jpg
761294018293xactual.jpg
761294057520xactual.jpg
761294057513xactual.jpg
761294053041xactual.jpg
761294053034xactual.jpg
52200020xactual.jpg
761294042656xactual.jpg
761294037195xactual.jpg
761294024881xactual.jpg
761294024874xactual.jpg
4957054022846xactual.jpg
761294022818xactual.jpg
4959112057623xactual.jpg
52244116xactual.jpg
Avatar of NVIT
NVIT
Flag of United States of America image

Sorry. I think you wanted to search with Windows, and not a cmd/batch solution, right?
Avatar of ITSysTech
ITSysTech

You would put this in the search bar with comma separation (in advanced search mode).  This works for XP. What OS are you using?

683274011097xactual,761294017814xactual,761294015193xactual
For Windows 10 or 7 your could use this.  683274011097xactual.jpg OR 761294017814xactual.jpg OR 761294015193xactual.jpg

Also, 081124555435 OR 081124555443 OR 081124553434
> I'd like to query the Windows folder "Images" to give results of a pre-determined list of item codes - say that are in a referring table

Can you elaborate?
Avatar of itsquad

ASKER

So thanks all... still stuck
The OR works, but the criteria I paste in gets truncated to the 255 limit.  
My first batch has 1,791 characters.  
Not sure if there's an outside program that would handle that or if there's
a setting in OS to open that up??

Thanks, Kevin
Hi Kevin,
I don't understand your requirements well. A few questions trying to clarify before it's possible to help you:

(1) What exactly do you mean by a "referring table"? An Excel spreadsheet? A table in Word? A plain text file with a line for each file name?

(2) Is the file name in the "referring table" fully qualified or is the path specified elsewhere? If the latter, where is the path specified?

(3) What exactly do you mean by "pull batches"? In other words, after querying/selecting around 100 pictures (that are in the "referring table"), what do you want to do with them?

Regards, Joe

UPDATE: I just noticed NVIT's excellent "Can you elaborate?" question. That's a great summary of what I'm looking for. :)
Avatar of itsquad

ASKER

Hi Joe, thanks for the reply!  Sorry for my semantics, I didn't mean it to read as a "read between the lines" kind of deal :D

Basically the bottom line question is...

Can I do a multi-file search in Windows 7 that's over 255 characters long?

I can generate a string of text that is formatted for multi-file search.  Example "1231254.jpg" OR "5466646.jpg" OR "456...."  
My problem is that the string I paste into the Windows 7 Search Box is way beyond 255 characters so no results happen.
When I put part of the string in that is under 255 characters, it works.

I was curious if anyone knew of maybe a software program that would be able to accommodate the over 255 characters limit or if there was a way to connect Windows 7 Search programming to perhaps an access table, xls, xml, vb, or word table or whatever data source to limit the results to just the file names desired.  

Hope that wasn't even more confusing, if it was... I'll be devastated!  :D

Thanks again, Kevin
> I'd like to query the Windows folder "Images" to give results of a pre-determined list of item codes - say that are in a referring table

I think what you want is to be able to pass each line of your "batch", i.e. search for, matching files in a folder. Is that correct?

If so, you can make a text file of the batch search terms. One term per line.

Then, pass each line to the FIND or FINDSTR command, which returns the matching file names.

But, as Joe asked: What will you do with the results? Do you wanna process those further?

Or, must the results exist in the Windows Search window?
Avatar of itsquad

ASKER

Hi NVIT, as far as I know, yes that is correct.
I will then need to copy those images to a different folder, so if the results did show in the Windows Search window, that'd be handy.
I don't know what "pass" really means and I don't know how to do a batch file.
Does this sound like a novice project for me to learn or how would you suggest I go about getting the batch file put together?

Thanks again, Kevin
We can help make a batch file for you.

In your sample list above:
IMAGEORIG
683274011097xactual.jpg
761294017814xactual.jpg
761294015193xactual.jpg
...

Open in new window


...is that list what you're searching for, i.e. where you enter what to search for?
ASKER CERTIFIED SOLUTION
Avatar of Joe Winograd
Joe Winograd
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of itsquad

ASKER

Joe & NVIT - You guys ROCK!!  Thanks a bunch!!  I remembered a program that I had used years ago called "Bulk Rename Utility".
They have an import function called "Rename Pairs" that you create as a .txt file in note pad.  Basically the txt file has
"Original File Name | New File Name".  With that I was able to rename the 2,500 files I wanted from the 26,000 files.  In the rename, I put a unique handle so I could grab them all from Windows search.  Then (even though I was getting truncated) I was able to old school/caveman them in from Windows search in about 30 minutes via copy paste. :D    Thanks again guys!  I look forward to referring back to the notes here on this post for future situations and hopefully I'll have more time to wrap my head around your guys' better & faster solution and not have to caveman it up!  :D
Hi Kevin...

I'm glad things turned out well for you. Having Joe the expert always helps, too...

"Bulk Rename Utility" is a great tool, also. And FREE! Your rename method is definitely caveman 🤣.

IIRC, it also has a regex feature that works similar to NPP. So, using BRU would definitely be faster. A very nice feature is the 'preview' option, which let's you verify the consequences first.
First, Kevin, thanks for the kind words — much appreciated! And thanks for letting us know how you solved the problem — feedback like that is very valuable. Rather than "caveman", I'd go with the kinder, gentler "old school". :)

Yes, Bulk Rename Utility is a good one...especially for free! Another good one in that space is Flash Renamer, but it's not free (although it is reasonably priced and offers a free trial).

My thanks, also, to NVIT for the compliments, which I'll send right back at you. Your batch file and RegEx skills are light years ahead of mine and I always learn a lot from your posts. It's a pleasure to collaborate with you on solutions here at Experts Exchange — such as this one.

Regards, Joe
Once we nailed down the exact requirements, we got to an answer. Splitting points evenly between the two experts who arrived at the batch file/scripting solution along with recommendations on how to build the source code in a text editor.