How does this work for subfolders and folders with a space?
regex:^(?!d:\\misc\\).*\.lnk$ works, but what if I want it to work for:
d:\all misc\
d:\misc\all misc
How to search files of a certain extension UNLESS they are in a certain folder?
-
harryray2
- Posts: 1147
- Joined: Sat Oct 15, 2016 9:56 am
-
void
- Developer
- Posts: 19904
- Joined: Fri Oct 16, 2009 11:31 pm
Re: How to exclude files of a certain extension UNLESS they are in a certain folder?
Spaces are treated as literal in exclude filters.
For example:
regex:^(?!d:\\all misc\\).*\.lnk$
For example:
regex:^(?!d:\\all misc\\).*\.lnk$
-
harryray2
- Posts: 1147
- Joined: Sat Oct 15, 2016 9:56 am
Re: How to exclude files of a certain extension UNLESS they are in a certain folder?
Apologies, I should have said in search as opposed to the exclude filters
-
void
- Developer
- Posts: 19904
- Joined: Fri Oct 16, 2009 11:31 pm
Re: How to search files of a certain extension UNLESS they are in a certain folder?
Please use double quotes (") to escape spaces in a search:
For example:
regex:"^(?!d:\\all misc\\).*\.lnk$"
For example:
regex:"^(?!d:\\all misc\\).*\.lnk$"
-
harryray2
- Posts: 1147
- Joined: Sat Oct 15, 2016 9:56 am
Re: How to search files of a certain extension UNLESS they are in a certain folder?
Thanks, I was putting the double quotes in the wrong place.
How about for sub folders? Just in the to delete folder:
D:\new folder (2)\to delete
And all folders underneath to delete:
D:\new folder (2)\to delete\folder 1\folder 2\
How about for sub folders? Just in the to delete folder:
D:\new folder (2)\to delete
And all folders underneath to delete:
D:\new folder (2)\to delete\folder 1\folder 2\
-
void
- Developer
- Posts: 19904
- Joined: Fri Oct 16, 2009 11:31 pm
Re: How to search files of a certain extension UNLESS they are in a certain folder?
subfolders are included by default, if you don't want subfolders, please try the following:
regex:"^(?!D:\\new folder (2)\\to delete\\[^\\]*\.lnk$)"
This is easier without regex:
!*.lnk | "D:\new folder (2)\to delete\*.lnk"
(no subfolders)
!*.lnk | "D:\new folder (2)\to delete\**.lnk"
(subfolders)
regex:"^(?!D:\\new folder (2)\\to delete\\[^\\]*\.lnk$)"
This is easier without regex:
!*.lnk | "D:\new folder (2)\to delete\*.lnk"
(no subfolders)
!*.lnk | "D:\new folder (2)\to delete\**.lnk"
(subfolders)