2

In windows XP, after switching to advanced search mode I used to be able to search for multiple files merely by adding a comma between them like this....

90025,90028,90094

and that would return the 3 image files that I was looking for.

How can I do this in Linux ??

balaji
  • 569

2 Answers2

3

I don't think you can use the gui for that. You could use the command line for that:

find /path/to/dir -regex ".*\(90025\|90028\|90094\).*"

This will search for file names containing these numbers.

Carl
  • 724
  • 3
  • 5
2

On the command line in gnome-terminal (konsole, yakuake, or whatever) then locate takes multiple arguments and searches for a match on any one of them.

locate 90025 90028 90094

Will return all files that match any of the strings.

man locate will give more information, for example how to match AND-wise, how to use regular expressions to search, etc.. locate relies on a database of files which is updated using sudo updatedb.

A BASH script one-liner like:

dirt=$(mktemp -d -p ~); cd $dirt; for i in $(locate 90025 90028 90094); do ln -s $i; done

Will make a temporary directory beneath your home directory that links to all of the files found in the locate command. You can sort through that directory and delete the soft links you don't want (this doesn't delete/affect the files they link to). I use a similar process to gather photos to share online.

pbhj
  • 3,231
  • Just reviewing this and it's notable that it doesn't work for filenames with spaces in, passing locate through xargs should work: something like dirt=$(mktemp -d -p ~); cd $dirt; for i in $(mlocate -i 90025 90028 9009 | xargs -0 echo ); do if [ -f "$i" ]; then ln -s "$i" $(mktemp -u XXXX)_$(basename "$i"); fi done works for me to handle files with spaces and filename clashes and avoid passing directories to ln (ie stop errors). – pbhj Aug 02 '20 at 23:27