Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
C:\Users\for\AppData\Roaming\Mozilla\Firefox\Profiles\fl43ywmg.default\places.SQlite

i want to skip the fl43ywmg.default folder to get the places.SQlite details in the Windows applications
Posted
Comments
dev_assault 2-Jan-15 8:07am    
this link provides what u exactly need http://stackoverflow.com/questions/17036395/how-to-exclude-folders-when-using-directory-getdirectories
dev_assault 2-Jan-15 8:11am    
or better would be that you put a filter like
var files = Directory.GetFiles(*name*).Where(name => !name.EndsWith("*.extension*"));
BillWoodruff 2-Jan-15 8:13am    
Is it the case here that there are several files named 'places.SQlite in different folders, and you want to find a version of that file that is not in the folder 'fl43ywmg.default ?
Srikanth59 2-Jan-15 8:16am    
i would like skip the some folder like fl43ywmg.default within path C:\Users\for\AppData\Roaming\Mozilla\Firefox\Profiles\fl43ywmg.default\places.SQlite
to get the details from that folder/
BillWoodruff 2-Jan-15 9:01am    
Also: what exactly are the "details" of that file you will get, and what will you do with them ?

So what are you doing now in your code ? Are you having trouble just getting started, or are you stuck trying to get something specific done ?

Does 'dev_assault's suggestion work for you ?

This is WinForms, WPF, ASP.NET ?

No you cannot skip the sequence of folders that have to be written. You would definitely have to write the entire string denoting the directory where your resource file (SQLite database) is present. Otherwise, you will get the error, FileNotFoundException[^] or so on and so forth. That is because while working with the third-party folders you are required to give a full-path to them. OS based folders, might be skipped.

Another answer[^], tells the same.

If anyways, you do not want your file to be present there, you can always Move (using the File.Move() method of System.IO namespace)[^] your file from one location to another location in order to use it over there. I believe this is a Firefox extension or dependency file I would like to recommend that you do not perform anything with this file, until or unless you know of any side-effects of this action on the extension or Firefox browser itself.
 
Share this answer
 
v2
Assuming your goal is to parse the contents of the files in the Directory:

C:\Users\for\AppData\Roaming\Mozilla\Firefox\Profiles

And, find the first folder that contains a file named 'places.SQlite whose name is not: 'fl43ywmg.default:
C#
// required
using System.IO;
using System.Linq;

// directories to ignore
private List<string> IgnoreDirectories = new List<string>
{
    "fl43ywmg.default", "Aunt Betty's Brown Bread", "Papa's Baked Beans"
}; 

private string basePath = @"C:\Users\for\AppData\Roaming\Mozilla\Firefox\Profiles\";

private void TestFindDirectory()
{
    // EnumerateDirectories filter does not implement regular expressions !
    string searchFilter = "*";

    var directories = Directory.EnumerateDirectories(basePath, searchFilter,
        SearchOption.AllDirectories).Select(dir => dir.Replace(searchFolderPath, ""));

    // for testing only
    //foreach (string str in directories)
    //{
        //Console.WriteLine("{0} {1}", str, IgnoreDirectories.Contains(str));
    //}
    // end for testing only

   // the IEnumerable<string> created above is only evaluated here !
    string directoryName = directories.First(dir => (! IgnoreDirectories.Contains(dir)));
}
Comment: depending on what information you wish to get from the enumerated file, or files, that match your criteria, you may wish to consider searching the enumerated FileInfo of Directories using 'DirectoryInfo.EnumerateDirectories. You could easily substitute using that here with a few changes.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900