Hi, on my desktop PC running leap 15.4 and KDE I would like to find files by filename excluding filenames part.
for example all file that doesn’t have “(1998)” and “(1999)” in theyr filename and have the possibility to select and move them.
is there a way in dolphin or in kfind or is there a GUI software to do this?
bor@bor-Latitude-E5450:~$ mkdir /tmp/find
bor@bor-Latitude-E5450:~$ touch /tmp/find/{'(1997)jdsklfjdsklf','(1998)jshjsdhfsdkj','sdjfkjdklfjdljfds(1999)'}
bor@bor-Latitude-E5450:~$ find /tmp/find -name '(1998)*' -prune -o -print
/tmp/find
/tmp/find/sdjfkjdklfjdljfds(1999)
/tmp/find/(1997)jdsklfjdsklf
bor@bor-Latitude-E5450:~$
See “man find” for details how to combine multiple conditions.
manythanks, following your suggestions this is another way:
pla@pla4-TW:~/find> lsasert(1996)vxdre.txt asert(1998)vxdre.txt asert(2002)vxdre.txt
asert(1997)vxdre.txt asert(1999)vxdre.txt comando per multiple conditions.txt
pla@pla4-TW:~/find> find ! -name '*(199?)*' -print
.
./comando per multiple conditions.txt
./asert(2002)vxdre.txt
pla@pla4-TW:~/find>
and this with multiple conditions another:
pla@pla4-TW:~/find> lsasert(1996)vxdre.txt asert(1998)vxdre.txt asert(2002)vxdre.txt
asert(1997)vxdre.txt asert(1999)vxdre.txt comando per multiple conditions.txt
pla@pla4-TW:~/find> find ! -name '*(1998)*' \( ! -name '*(1999)*' \) \( ! -name '*(1997)*' \) -print
.
./comando per multiple conditions.txt
./asert(1996)vxdre.txt
./asert(2002)vxdre.txt
pla@pla4-TW:~/find>
but, isn’t it a GUI software way to do this?
I doubt one can design a GUI as flexible as the find tool, eventual in combination with grep.
If you don’t mind making several passes, Dolphin could be used, although it’s rather convoluted:
- Navigate to the directory containing the files
- Use the filter bar to filter on (for example) 1998
- Select all using Ctrl-A
- Clear the filter
- Invert selection using Ctrl-Shift-A
You now have all files that don’t contain 1998 selected.
Repeat for other sub-strings you want to exclude.
Yes, indeed covoluted lol!
And do you ten have also files from sub-directories (which find does)?
Unfortunately not. One would need to repeat that for each directory / subdirectory.
manythanks, I already did it, but I cannot use with multiple conditions
Indeed, Dolphin’s filter does not allow AND/OR conditions, that’s why I said it’s rather convoluted and would require several passes; but by moving files selected in the first pass to a temporary location and then applying further filter/select/clear filter/invert/move you could ultimately achieve your aim…
Maybe
catfish
It’s GUI search tool in xfce. It can be installed in any other DE.
It’s always there in my xfce installation but never tried using it, so no idea if it as good as find.
yes, I tried and for few conditions it’s fine, but for many conditions not too much
tried, practicaly useless in this case, better the dolphin filter bar as tannington suggested
OK… I obviously don’t know how many directories / files / sub-strings are involved, but acknowledge there would be a point at which my suggestion became impractical.
In which case I’m sorry, I know of no GUI method (if indeed there is one) that would achieve your aim. Maybe others will come to your rescue…
Are all the 1998 & 1999 files in the current directory? If yes, any file manager should be able to do it simply. In MC:
$ * # select all files
-
*1998*
<enter> # doit
-
*1999*
<enter>
F6 # move
<select target location, if not already selected>
<enter>
(done)
As little as 19 keystrokes total, depending on how confirmations are configured.
Hi,
I think it’s a nifty gui search tool. If you figure out how to use it.
I was confuse the first time I tried it then have figured out how it work from some tips in the internet.
It’s using find and locate in the background.
But it doesn’t fulfill pier’s requirements to **exclude **some patterns/file name parts.
taking idea from your suggestion to move files in a temporary directory I tried to use find to do it, it is not so simple but it can be done in a axecutable file and become simple, but it seems to work, tested with three conditions but can be done with very more
pla@pla4-TW:~/find> find ! -name '*(1998)*' \( ! -name '*(1999)*' \) \( ! -name '*(1997)*' \) -exec mv {} /home/pla/find/aaa \;mv: cannot move '.' to '/home/pla/find/aaa/.': Device or resource busy
mv: cannot move './aaa' to a subdirectory of itself, '/home/pla/find/aaa/aaa'
mv: './aaa/.comando per multiple conditions.txt.kate-swp' and '/home/pla/find/aaa/.comando per multiple conditions.txt.kate-swp' are the same file
pla@pla4-TW:~/find>
have you any suggestion about find -exec command?
Take a look at this description of combining move with find:
files - How to integrate mv command after find command? - Unix & Linux Stack Exchange
If you click the settings - preference - advance tab. there is an option to exclude from search.
is that what you want if not then it really not going to help.
This excludes only directories. But pier wants to exclude all results which have “1998” in the **filename **(e.g. yourdiary1998.txt). This is something completely different.