3

I want to find old pictures on an old disk with a certain date,
name of disk : /dev/sdf ,
Wich command should I use?

6

This is easier done if you cd to the root directory of the file system you believe the pictures are in. You would want to mount the disk to something like /images and then

cd /images

find . -ctime n -name "*.jpg"

Where n = the number for days ago that the picture image was created.

To search the entire system:

sudo find / -ctime n -name "*.jpg"

You don't need sudo to find pictures you own but if you search the entire system you'll get a lot of permission denied errors if you don't.

If you have a lot of image files, you can pipe the output to a file:

find . -ctime n -name "*.jpg" >> $HOME/mypics.txt

There are a other time options, they work backwards in 24 hour increments or in minute increments like -cmin. For more information:

man find

You can also use -newerXY and ! -newerXY:

Example: To find all files modified between June 1, 2017 and July 3, 2017:

find . -newermt 2017-06-01 ! -newermt 2017-07-03 -name "*.jpg" 
  • This is the answer I neeeded. Thanx a lot jones0610 – Mokum Jul 4 '17 at 17:06
  • @Mokum You're very welcome. Glad I could help! – jones0610 Jul 5 '17 at 0:23
1

I think I would just use find and go through all pictures. If you cannot be sure that the date of the original picture actually matches the file (like if it was copied or modified) I would just go through all pictures. On command line you can use find <path to mounted drive> -iname *.jpg And replace with your mountpoint. Alternatively, you can also do a similar search in a graphical file manager.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.