using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.IO;
using System.Windows.Forms;
namespace Utillity_1
{
public partial class Form1 : Form
{
public string source_path = "E:\\Received files";
public string destination_path = "D:\\Saqib\\Approved";
public Form1()
{
InitializeComponent();
}
private void btn_Browse_Click(object sender, EventArgs e)
{
openFileDialog1.Title = "Open CSV/TSV File";
openFileDialog1.Filter = "CSV(*.csv)|*.csv";//|TSV(*.tsv)|*.tsv";
openFileDialog1.Multiselect = false;
// openFileDialog1.ShowDialog();
try
{
string[] filePaths = Directory.GetFiles(source_path,"*.zip");
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
StreamReader csv_reader = new StreamReader(openFileDialog1.FileName);
//string temp = csv_reader.ReadToEnd();
string temp=null;
while (!csv_reader.EndOfStream)
{
string line = csv_reader.ReadLine();
if (!(string.IsNullOrEmpty(line)))
{
string[] values = line.Split(',');
// temp += values[0];
// temp += Environment.NewLine;
foreach (string file in filePaths)
{
//Console.WriteLine(file);
if (file.EndsWith(".zip"))
{
string path = Path.GetFileName(file);
string[] to_get_filename = path.Split('.');
string filename = to_get_filename[0];
if (filename.Equals(values[1]))
{
// MessageBox.Show(file);
// source_path +="\\"+ filename+".zip";
destination_path = Path.Combine(destination_path, path);
// File.Move(file, destination_path);
File.Copy(file, destination_path, true);
}
}
}
}
}
MessageBox.Show(temp);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void btn_Close_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Really Close?", "Confirm close", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
this.Close();
}
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.IO;
using System.Windows.Forms;
namespace Utillity_1
{
public partial class Form1 : Form
{
public string source_path = "E:\\Received files";
public string destination_path = "D:\\Saqib\\Approved";
public Form1()
{
InitializeComponent();
}
private void btn_Browse_Click(object sender, EventArgs e)
{
openFileDialog1.Title = "Open CSV/TSV File";
openFileDialog1.Filter = "CSV(*.csv)|*.csv";//|TSV(*.tsv)|*.tsv";
openFileDialog1.Multiselect = false;
// openFileDialog1.ShowDialog();
try
{
string[] filePaths = Directory.GetFiles(source_path,"*.zip");
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
StreamReader csv_reader = new StreamReader(openFileDialog1.FileName);
//string temp = csv_reader.ReadToEnd();
string temp=null;
while (!csv_reader.EndOfStream)
{
string line = csv_reader.ReadLine();
if (!(string.IsNullOrEmpty(line)))
{
string[] values = line.Split(',');
// temp += values[0];
// temp += Environment.NewLine;
foreach (string file in filePaths)
{
//Console.WriteLine(file);
if (file.EndsWith(".zip"))
{
string path = Path.GetFileName(file);
string[] to_get_filename = path.Split('.');
string filename = to_get_filename[0];
if (filename.Equals(values[1]))
{
// MessageBox.Show(file);
// source_path +="\\"+ filename+".zip";
destination_path = Path.Combine(destination_path, path);
// File.Move(file, destination_path);
File.Copy(file, destination_path, true);
}
}
}
}
}
MessageBox.Show(temp);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void btn_Close_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Really Close?", "Confirm close", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
this.Close();
}
}
}
}