Hi
@dimzev, and welcome! Your best answer will probably come from
@JasKinasis when he pops in, but I'll start off by separating your first request.... how to find. There will be many different ways to solve your problem, and I just stumble along with the command line, so my methods are not likely to be the best way.
From a specific file I want find all images(JPG,jpg,png,...)
This is a little confusing. I guess that you mean "from a specific folder (or location)" because the image files won't be stored in another file, unless it is a zip file, tar file, or some other type of archive. But you did not give us a specific folder or location, so we might only substitute some examples, like these:
Code:
find / -name '*.jpg'
find /home -name '*.jpg'
find /home/dimzev -name '*.jpg'
find . -name '*.jpg'
This would find all .jpg files in 1. your whole computer (/), 2. the home folder of all users, 3. just your own home folder, or 4. just in your current folder (.), wherever you are. This find search is recursive and will also search inside hidden folders. If you get a "Permission denied" error you will need to use sudo with the find command. Testing this in your /home folder will probably show a lot of .jpg files!
Okay, now a little differently... change
-name to
-iname and it will find .jpg and .JPG (case no longer matters).
Now, we can add the
OR operator (-o) so that your search will look for multiple image types.
Code:
find / -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.bmp'
find /home -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.bmp'
find /home/dimzev -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.bmp'
find . -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.bmp'
So, with this pattern above, you can choose which image files you want to search for, and it will not matter whether uppercase or lowercase. I'm sure there are better ways, but this is just an example to get you thinking about how it can be done using the Linux
find command.
I've got to run for now, so maybe others will add on to this, or get to the next step: MOVE the files that you have found. You will want to make sure you are careful when moving files. You may have unintended consequences.... like all of your menu icons or desktop icons could be gone! It's always a good idea to create a test folder to hold all the image files that you want to experiment with, and do your work from there, and not from the root (/).
Cheers