private void fileGDBforADMToolStripMenuItem_Click(object sender, EventArgs e) { this.Log("Starting export", true); dlgSelectDBs.Title = "Please select one or more *.accdb files as submitted by the contractors"; if (dlgSelectDBs.ShowDialog() != System.Windows.Forms.DialogResult.OK) { this.Log("Please select one or more files..."); return; } var mFileInfo = new FileInfo(dlgSelectDBs.FileNames[0]); dlgSelectFolder.RootFolder = Environment.SpecialFolder.Desktop; dlgSelectFolder.SelectedPath = mFileInfo.DirectoryName; dlgSelectFolder.Description = "Please select a FileGDB to append to - or a directory to create a new FileGDB..."; if (dlgSelectFolder.ShowDialog() != System.Windows.Forms.DialogResult.OK) { this.Log("Please select an output filename"); return; } string mSelectedFolder = dlgSelectFolder.SelectedPath; if (mSelectedFolder.EndsWith(".gdb")) { Log(String.Format("Appending to existing ESRI FileGDB ({0})", mSelectedFolder)); } else { int mIdx = 1; var mFolder = mSelectedFolder + "\\OnwaniFGDB.gdb"; while (Directory.Exists(mFolder)) { mFolder = mSelectedFolder + "\\OnwaniFGDB" + mIdx.ToString("000") + ".gdb"; mIdx++; } Log(String.Format("Using ESRI FileGDB ({0})", mFolder)); mSelectedFolder = mFolder; } try { ExtFunctions.ExportMultipleToOGR(this, dlgSelectDBs.FileNames, mSelectedFolder); } catch (Exception ex) { Log("Operation aborted: " + ex.Message); } }