Page 1 of 1
Select files that does not have some text
Posted: 03 Nov 2010, 02:55
by docfxit
I'd like to find out how to select all files that do not have the following text:
<ToReturnCode>31
in the file.
I'd like to have them in either the left or right side of Salamander.
Thank you,
Docfxit
Re: Select files that does not have some text
Posted: 03 Nov 2010, 07:04
by therube
Finding should be easy.
The "!" is a NOT operator.
So something like "!<ToReturnCode>31" ? (You may need to escape the brackets?)
That should provide you with the list of file names that you want.
Next part is harder ...?
Perhaps if you said what your intentions are with the found files?
Perhaps ...
Can the names (& or path/names) be sent to a list?
Or dragged to another application that would accept the names - as a list (rather then a file), such as a file name renamer. And with that you could add something unique to the names, like a prefix of "XXX-". Salamander would see that change. The files in question would be obvious & sortable ...
Re: Select files that does not have some text
Posted: 03 Nov 2010, 14:17
by Ether
Find the files using Find,
make a list of those files (you just need to substitute
$(FullName) with
$(Name) , copy the list to the clipboard and then
Edit > Advanced > Load Selection... and
Edit > Invert Selection.
Re: Select files that does not have some text
Posted: 03 Nov 2010, 17:39
by docfxit
therube wrote:Finding should be easy.
The "!" is a NOT operator.
So something like "!<ToReturnCode>31" ? (You may need to escape the brackets?)
That should provide you with the list of file names that you want.
Thank you for the reply.
Let's start with the easy part.
When I use "!<ToReturnCode>31" without the quotes in the Containing field I get no files.
When I use "!31" I get no files.
When I use "ToReturnCode>32" I get lots of files. (If there is a 32 there wouldn't be a 31 so all these files and more should show when I use "!31")
I'm not sure how to escape the brackets.
When I use "^!<ToReturnCode>31" I get no files.
When I use "!^<ToReturnCode>31" I get no files.
When I use "^!^<ToReturnCode^>31" I get no files.
When I use "^!31" I get no files.
When I use "!^31" I get no files.
I'm using ver. 2.54
A typical file looks like this:
Code: Select all
- <DAZzle Layout="C:\Programs\DAZzle\Envelope4300.lyt" OutputFile="M:\Results\Test.XML" Start="PRINTING" Test="No" Prompt="NO" AutoClose="YES">
- <Package ID="1">
<MailClass>FIRST</MailClass>
<DateAdvance>0</DateAdvance>
<PackageType>ENVELOPE</PackageType>
<Oversize>FALSE</Oversize>
<WeightOz>1</WeightOz>
<Width>4</Width>
<Length>9.5</Length>
<Depth>.1</Depth>
<Services>CertifiedMail="OFF" DeliveryConfirmation="Off"</Services>
<Value>0.00</Value>
<Description>Correspondence</Description>
<ReferenceID>0038005</ReferenceID>
<ToEmail>Sample@notreal.org</ToEmail>
<ToZIP4>7564</ToZIP4>
<ToDeliveryPoint>99</ToDeliveryPoint>
<ToCarrierRoute>C051</ToCarrierRoute>
<ToReturnCode>32</ToReturnCode>
<PIC>00040000745025535127</PIC>
<FinalPostage>0.44</FinalPostage>
<TransactionID>3593</TransactionID>
<TransactionDateTime>20101102132448</TransactionDateTime>
<PostmarkDate>20101102</PostmarkDate>
<Status>Success</Status>
</Package>
</DAZzle>
Any ideas?
Thank you,
Docfxit
Re: Select files that does not have some text
Posted: 04 Nov 2010, 07:23
by Jan Patera
docfxit wrote:I get no files.
Not mentioned above, therefore double-checking: did you check the "Regular expression" checkbox?
Re: Select files that does not have some text
Posted: 04 Nov 2010, 08:18
by therube
Sorry about that, I was wrong.
! is not NOT.
When I was testing, my initial search string was found in my file list. When I (what I thought) was "not'ing" it, so !string, it was not in any of the files, so returned nothing. I (unfortunately & incorrectly) took that to mean it was working as I expected, but it was not.
Now can you negate a R/E search string ...? Kind of getting beyond my capabilities if you can? And thinking it still will not return your expected results.
I think the problem is that when you (I) are looking for the negated string ("NOT.string), if found, we then expect the search to kick out & to not include that file in the list.
But what it actually is doing is finding other characters in the file that are not your NOT.string, & it is those that will cause the file to be in the list regardless. IOW, if the file only contained your NOT.string, & nothing else, then finding NOT.string would cause the file to not be listed (I think).
Re: Select files that does not have some text
Posted: 04 Nov 2010, 09:39
by therube
A (command line) UNIX-like "grep" can do it easily.
ftp://ftp.delorie.com/pub/djgpp/current ... rep27b.zip
Where -L is ...
Code: Select all
-L, --files-without-match print only names of FILEs containing no match
A (small, free, standalone) GUI grep,
AstroGrep has a "Negation" option.
Re: Select files that does not have some text
Posted: 04 Nov 2010, 10:15
by Jan Rysavy
Ether wrote:Find the files using Find,
make a list of those files (you just need to substitute
$(FullName) with
$(Name) , copy the list to the clipboard and then
Edit > Advanced > Load Selection... and
Edit > Invert Selection.
This is good solution. Just use Commands >
Find Files and Directories command. Set the
Search file content option and enter your string "<ToReturnCode>31" (without quotes) into the
Containing field.
Re: Select files that does not have some text
Posted: 04 Nov 2010, 10:19
by therube
Though he is looking for files that do NOT contain the search string.
Re: Select files that does not have some text
Posted: 04 Nov 2010, 10:54
by Ether
therube wrote:Though he is looking for files that do NOT contain the search string.
Yeah, but he cares only about the selection of files in the panel, not in the way of obtaining it. After you import the list of found files and invert selection, you get the correct set of files.
therube wrote:A (command line) UNIX-like "grep" can do it easily.
That is also a good solution, but since I'm not familiar with grep's syntax, I went with the Find & batch file method.
Re: Select files that does not have some text
Posted: 04 Nov 2010, 13:49
by docfxit
Thank you all for your great suggestions.
To make it easier for the next person, I'm going to try to put what I did in one reply.
I chose to create the list of files I don't want directly into the clipboard.
I set up a user command:
Define new command in Salamander Options > Configuration > User Menu.
Name "Put List of Files in Find to the clipboard" (without the quotes).
Command: echo
Arguments: $(Name)>>"$[TEMP]\file_list.txt" && clip < "$[TEMP]\file_list.txt"
turn off the Open shell windows option.
Because I'm running in XP (that doesn't have the clip.exe file) I downloaded the clip.exe file from:
ftp://ftp.microsoft.com/Services/TechNe ... E/CLIP.EXE
I copied clip.exe to my C:\Windows\system32.
In the find window I selected all the files that I didn't want.
"<ToReturnCode>31" (without the quotes)
Then I selected all items in the Find windows (Ctrl+A), open User Menu (F9) and selected "Put List of Files in Find to the clipboard"
I had to wait a long time for it to finish. It doesn't give you any notice when it's done.
I went back to Salamander, selected the correct pane, Edit > Advanced > Load Selection... and Edit > Invert Selection.
I copied the selected files to the opposite pane.
I ended up with the files I wanted. All files without "<ToReturnCode>31"
That turned out great. I had no idea it could be done in Salamander.
Thanks a bunch,
Docfxit
Re: Select files that does not have some text
Posted: 04 Nov 2010, 15:27
by therube
Yeah, but he cares only about the selection of files in the panel, not in the way of obtaining it. After you import the list of found files and invert selection, you get the correct set of files.
Oh, I see now. You're right

.