-
October 26th, 2012, 01:08 PM
#1
RegEx driving me nuts - help needed
Hi
I am no expert in regular expressions - and have for hours tried several things in order to solve my problem without any luck....
I need a Regular Expression, that will match all files in a specific folder - except those ending in ".pst" ... And it must only match in the specified folder, not if a non-pst file exists in another folder..
MS Outlook default places PST files in c:/users/username/AppData/Local/Microsoft/Outlook/ - so the path must match ".*/Users/.*/AppData/Local/Microsoft/Outlook"
The files in that folder could be named:
Code:
Test.pst
user.name@domain.com.ost
test.local.pst
In this case, the two files with the PST extension should not be listed/matched - but the file ending in .ost should....
Can anyone help me ?
Regards
/R
-
October 29th, 2012, 12:00 PM
#2
Re: RegEx driving me nuts - help needed
Why are you using a regex to do this? Why not create a file object for the directory you want to look for files in and then call the File objects listFiles() method passing in a FilenameFilter to only accept files not ending in .pst.
-
November 4th, 2012, 07:09 AM
#3
Re: RegEx driving me nuts - help needed
The problem is, that it is to be used as an exclusion mask in a pc backup product... Unfortunately I can only specify folders to be backed up - but not specify file wildcard together with the folder name...
The only way to exclude non-PST files from backup, is to create a RegEx filter, that matches all non-PST files in the specified folder...
-
November 7th, 2012, 04:29 AM
#4
Re: RegEx driving me nuts - help needed
Sorry but you haven't added any information that makes me change my mind on the easiest way to solve this. FilenameFilters are designed for filtering file names, you can even use a regex within a FilenameFilter object if you really need to but I doubt that is necessary in your case as you are just filtering on the ".pst" extension.
I'm not clear if you only want files with a .pst extension or those without it but it's essentially the same logic with a negated return value in one of the cases.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|