Solved

DOS search for .jpg between two dates,

Posted on 2013-11-03
14
385 Views
Last Modified: 2014-06-11
I need to find photo on a hard drive between two dates. The date is a birth of a child and pics are missing, I have a back up.

Dir *.jpg /s  

But how to get say between 1.1.2000 and 1.1.2001. ?
0
Comment
Question by:fcek
[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
  • 4
  • 2
  • 2
  • +4
14 Comments
 
LVL 20

Expert Comment

by:n2fc
ID: 39619755
Add /OD (i.e. dir *.jpg /s /od)   to additionally sort by date
0
 
LVL 55

Expert Comment

by:Bill Prew
ID: 39619759
I'm away from a computer right now, but since this is a one time need, I'd suggest just taking the output of DIR and piping it into a find to get you close.  In your case it seems like you think it would have a year of 2000, so perhaps something like:

dir /s /a-d *.jpg | find "2000 "

This will get you some file names, but then you will have to locate their folders, so you can take a file name and do:

dir /a-d /s /b c:\filename.jpg

It's a little crude, but might help you track them down.

On the first DIR you might consider the option to specify the create date rather than the modified date, although if you know you never edited the pictures than that may not matter. If you do DIR /? You can see the various options.

~bp
0
 
LVL 34

Expert Comment

by:Michael-Best
ID: 39619768
by date: dir /o:d
by name: dir /o:n
by size: dir /o:s
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 7

Expert Comment

by:peea
ID: 39619772
Let's assume that no file name contains "2000" or "2001", you may use two DIR + FIND to list the related pictures.

DIR \*. JPG /S | FIND "2000" > B.TXT
DIR \*. JPG /S | FIND "01/01/2001" >> B.TXT
TYPE B.TXT

B.TXT will contain a list of all pictures taken in 200 and on 1/1/2001.
0
 
LVL 15

Expert Comment

by:Giovanni Heward
ID: 39619812
Here's an approach which satisfies your requirements.  Bear in mind processing time may be lengthy.

@echo off
setlocal enabledelayedexpansion
set startdate=20000101
set enddate=20010101
set output=%temp%\results.txt
set ext=jpg
set drive=C:
set location=%userprofile%\Documents
set location=!location:\=\\!
set location=!location:~2!
echo Searching drive !drive! @ !location!...
wmic datafile where "drive='!drive!' and path like '!location!\\%' and extension='!ext!' and filesize>'0' and lastmodified>'!startdate!' and lastmodified<'!enddate!'" get InstallDate, LastModified,LastAccessed, Name>!output!

Open in new window


Modify the startdate, enddate, drive and first location variable to reflect your target.

startdate and enddate expressed as YYYYMMDD
drive is expressed as X:
location is express as X:\FOLDER\PATH
0
 

Author Comment

by:fcek
ID: 39620090
Great. Some good ideas there.

As I know the exact birth date I can start there and I can use a combination of the ideas above.

Will report back
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 39620265
If you can't find and you have made any amendments to the photo, even rotated it don't forget it could have a different date...
0
 

Author Comment

by:fcek
ID: 39628294
Thanks.
0
 

Author Comment

by:fcek
ID: 39628696
x66_x72_x65_x65

Id like to give that a try.  Ive saved everything to an ext drive called X:
There are subfolders but the top folder is called say .....   ABC
There are no userprofiles as Ive moved my docs to its root (from XP) in there.  

Im making a batch file out of that I presume?
 
Thanks
0
 
LVL 15

Accepted Solution

by:
Giovanni Heward earned 250 total points
ID: 39628703
Exactly.  It should look something like this:

@echo off
setlocal enabledelayedexpansion
set startdate=20000101
set enddate=20010101
set output=%temp%\results.txt
set ext=jpg
set drive=X:
set location=X:\ABC
set location=!location:\=\\!
set location=!location:~2!
echo Searching drive !drive! @ !location!...
wmic datafile where "drive='!drive!' and path like '!location!\\%' and extension='!ext!' and filesize>'0' and lastmodified>'!startdate!' and lastmodified<'!enddate!'" get InstallDate, LastModified,LastAccessed, Name>!output!
if exist %temp%\results.txt type %temp%\results.txt

Open in new window

0
 
LVL 55

Assisted Solution

by:Bill Prew
Bill Prew earned 250 total points
ID: 39629144
I almost forgot one of my favorite utilities, Swiss File Knife. If you can use a small utility you might want to give this a try, it could do exactly what you need, and it's FAST!

Download from here (all you need is the sfk.exe file)

    http://stahlworks.com/dev/swiss-file-knife.html

And try a command like this:

    sfk list -since 20000101 -before 20010101 c:\temp *.jpg

~bp
0
 

Author Comment

by:fcek
ID: 39667809
Had a flu and when recovered got bogged under with work.
Getting back to this very soon and will report back
Thanks
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_2459…
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

734 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