string[] reg = Directory.GetFiles(@folderBrowserDialog1.SelectedPath, "*.reg");<br/>
<br/>
string destinationFolder = "Reg";<br/>
DirectoryInfo di1 = new DirectoryInfo(folderBrowserDialog1.SelectedPath);<br/>
FileInfo[] lstFiles1 = di1.GetFiles("*.reg");<br/>
foreach (FileInfo fi in lstFiles1)<br/>
{<br/>
if (fi.Name.EndsWith(".reg"))<br/>
{<br/>
<br/>
<br/>
if (!Directory.Exists(folderBrowserDialog1.SelectedPath + "\" + destinationFolder))<br/>
{<br/>
Directory.CreateDirectory(folderBrowserDialog1.SelectedPath + "\" + destinationFolder);<br/>
}<br/>
string DestinationDir = @folderBrowserDialog1.SelectedPath + "\" + destinationFolder;<br/>
foreach (string file in reg)<br/>
{<br/>
File.Move(file, Path.Combine(DestinationDir, Path.GetFileName(file)));<br/>
}<br/>
for (int i = progressBar1.Minimum; i <= progressBar1.Maximum; i++)<br/>
{<br/>
progressBar1.PerformStep();<br/>
<br/>
}<br/>
MessageBox.Show("Done!", "Done!",<br/>
MessageBoxButtons.OK, MessageBoxIcon.Asterisk);<br/>
<br/>
}<br/>
else<br/>
{<br/>
MessageBox.Show("No File", "No file!",MessageBoxButtons.OK, MessageBoxIcon.Exclamation);<br/>
}<br/>
<br/>
<br/>
<br/>
}<br/>
}
Else Not work in this code What error?
thnx
View the full article
<br/>
string destinationFolder = "Reg";<br/>
DirectoryInfo di1 = new DirectoryInfo(folderBrowserDialog1.SelectedPath);<br/>
FileInfo[] lstFiles1 = di1.GetFiles("*.reg");<br/>
foreach (FileInfo fi in lstFiles1)<br/>
{<br/>
if (fi.Name.EndsWith(".reg"))<br/>
{<br/>
<br/>
<br/>
if (!Directory.Exists(folderBrowserDialog1.SelectedPath + "\" + destinationFolder))<br/>
{<br/>
Directory.CreateDirectory(folderBrowserDialog1.SelectedPath + "\" + destinationFolder);<br/>
}<br/>
string DestinationDir = @folderBrowserDialog1.SelectedPath + "\" + destinationFolder;<br/>
foreach (string file in reg)<br/>
{<br/>
File.Move(file, Path.Combine(DestinationDir, Path.GetFileName(file)));<br/>
}<br/>
for (int i = progressBar1.Minimum; i <= progressBar1.Maximum; i++)<br/>
{<br/>
progressBar1.PerformStep();<br/>
<br/>
}<br/>
MessageBox.Show("Done!", "Done!",<br/>
MessageBoxButtons.OK, MessageBoxIcon.Asterisk);<br/>
<br/>
}<br/>
else<br/>
{<br/>
MessageBox.Show("No File", "No file!",MessageBoxButtons.OK, MessageBoxIcon.Exclamation);<br/>
}<br/>
<br/>
<br/>
<br/>
}<br/>
}
Else Not work in this code What error?
thnx
View the full article