private static void uploadZipFiles() { FtpUtil ftpUtil = new FtpUtil("192.168.0.30", Config.GetFtpUser(), Config.GetFtpPwd(), "21"); DirectoryInfo directorySelected = new DirectoryInfo(Config.GetPath()); DirectoryInfo backDictory = new DirectoryInfo(Config.GetBackUpPath()); if (backDictory.Exists == false) { backDictory.Create(); } if ( (File.Exists(Config.GetPath() + "OPT10001_FTP.dat") == true) && (File.Exists(Config.GetPath() + "OPT10014_FTP.dat") == true) && (File.Exists(Config.GetPath() + "OPT10015_FTP.dat") == true) && (File.Exists(Config.GetPath() + "OPT10059_1_1_FTP.dat") == true) && (File.Exists(Config.GetPath() + "OPT10059_1_2_FTP.dat") == true) && (File.Exists(Config.GetPath() + "OPT10059_2_1_FTP.dat") == true) && (File.Exists(Config.GetPath() + "OPT10059_2_2_FTP.dat") == true) && (File.Exists(Config.GetPath() + "OPT10080_FTP.dat") == true) && (File.Exists(Config.GetPath() + "OPT10081_FTP.dat") == true) ) { //FileInfo[] fileList = directorySelected.GetFiles(startsWithZip + "*" + endsWithZip + ".zip"); FileInfo[] fileList = directorySelected.GetFiles("*.zip"); //모든 zip파일을 옮기자 foreach (FileInfo file in fileList) { bool ret1 = ftpUtil.Upload("/home/jijs/rubytest/mysqloader/data", file.FullName); FileLog.PrintF("UploadEosFiles ftpUtil.Upload=>" + file.Name + "_" + ret1.ToString()); if (ret1 == true) { FileLog.PrintF("UploadEosFiles path\\BACKUP=>" + Config.GetBackUpPath()); FileLog.PrintF("UploadEosFiles file.FullName=>" + file.FullName); FileLog.PrintF("UploadEosFiles file.Name=>" + file.Name); File.Move(file.FullName, Config.GetBackUpPath() + file.Name); } } /* * bool ret2 = ftpUtil.Upload("/home/jijs/rubytest/mysqloader/data", checkFile.FullName); * FileLog.PrintF("UploadEosFiles ftpUtil.Upload=>" + checkFile.Name + "_" + ret2.ToString()); * if (ret2 == true) * { * File.Delete(checkFile.FullName); * } */ } }
public static void PushFtpZipFiles() { DirectoryInfo directorySelected = new DirectoryInfo(Config.GetPath()); FileInfo[] fileList = directorySelected.GetFiles("*.zip"); FtpUtil ftpUtil = new FtpUtil("192.168.0.30", Config.GetFtpUser(), Config.GetFtpPwd(), "21"); /*FTP 서버에 있는 파일들 읽어오기 * String[] test = ftpUtil.GetFileList("/home/jijs/rubytest/mysqloader/BACKUP/"); * for (int i = 0; i < test.Length; i++) * { * Console.WriteLine(test[i]); * } */ /* * //파일 다운로드 테스트. * String dirPath = System.IO.Path.GetDirectoryName(path); * String tmp = dirPath + "\\OPT10081_20160208.zip"; * Console.WriteLine("dirPath =" + dirPath); * Console.WriteLine("tmp =" + tmp); * bool ret = ftpUtil.Download(tmp, "/home/jijs/rubytest/mysqloader/data/OPT10081_20160208.zip"); * Console.WriteLine("ftpUtil.Download ret =" + ret); */ /* * //파일 업로드 테스트. * String dirPath1 = System.IO.Path.GetDirectoryName(path); * String tmp1 = dirPath + "\\OPT10081_000020_20160209.log"; * Console.WriteLine("dirPath1 =" + dirPath1); * Console.WriteLine("tmp1 =" + tmp1); * // String fileName= Path.GetFileName(tmp1); * //Console.WriteLine("ftpUtil.Upload fileName =" + fileName); * bool ret1 = ftpUtil.Upload("/home/jijs/rubytest/mysqloader/data", tmp1); * Console.WriteLine("ftpUtil.Upload ret1 =" + ret1); */ foreach (FileInfo file in fileList) { bool ret1 = ftpUtil.Upload("/home/jijs/rubytest/mysqloader/data", file.FullName); FileLog.PrintF("PushFtpZipFiles ftpUtil.Upload file.Name_ret1=" + file.Name + "_" + ret1.ToString()); } }
public static void PushFtpZipFiles() { DirectoryInfo directorySelected = new DirectoryInfo(Config.GetPath()); FileInfo[] fileList = directorySelected.GetFiles("*.zip"); FtpUtil ftpUtil = new FtpUtil("192.168.0.30", Config.GetFtpUser(), Config.GetFtpPwd(), "21"); /*FTP 서버에 있는 파일들 읽어오기 String[] test = ftpUtil.GetFileList("/home/jijs/rubytest/mysqloader/BACKUP/"); for (int i = 0; i < test.Length; i++) { Console.WriteLine(test[i]); } */ /* //파일 다운로드 테스트. String dirPath = System.IO.Path.GetDirectoryName(path); String tmp = dirPath + "\\OPT10081_20160208.zip"; Console.WriteLine("dirPath =" + dirPath); Console.WriteLine("tmp =" + tmp); bool ret = ftpUtil.Download(tmp, "/home/jijs/rubytest/mysqloader/data/OPT10081_20160208.zip"); Console.WriteLine("ftpUtil.Download ret =" + ret); */ /* //파일 업로드 테스트. String dirPath1 = System.IO.Path.GetDirectoryName(path); String tmp1 = dirPath + "\\OPT10081_000020_20160209.log"; Console.WriteLine("dirPath1 =" + dirPath1); Console.WriteLine("tmp1 =" + tmp1); // String fileName= Path.GetFileName(tmp1); //Console.WriteLine("ftpUtil.Upload fileName =" + fileName); bool ret1 = ftpUtil.Upload("/home/jijs/rubytest/mysqloader/data", tmp1); Console.WriteLine("ftpUtil.Upload ret1 =" + ret1); */ foreach (FileInfo file in fileList) { bool ret1 = ftpUtil.Upload("/home/jijs/rubytest/mysqloader/data", file.FullName); FileLog.PrintF("PushFtpZipFiles ftpUtil.Upload file.Name_ret1=" + file.Name + "_" + ret1.ToString()); } }
private static void uploadZipFiles() { FtpUtil ftpUtil = new FtpUtil("192.168.0.30", Config.GetFtpUser(), Config.GetFtpPwd(), "21"); DirectoryInfo directorySelected = new DirectoryInfo(Config.GetPath()); DirectoryInfo backDictory = new DirectoryInfo(Config.GetBackUpPath()); if (backDictory.Exists == false) { backDictory.Create(); } if ( (File.Exists(Config.GetPath() + "OPT10001_FTP.dat") == true) && (File.Exists(Config.GetPath() + "OPT10014_FTP.dat") == true) && (File.Exists(Config.GetPath() + "OPT10015_FTP.dat") == true) && (File.Exists(Config.GetPath() + "OPT10059_1_1_FTP.dat") == true) && (File.Exists(Config.GetPath() + "OPT10059_1_2_FTP.dat") == true) && (File.Exists(Config.GetPath() + "OPT10059_2_1_FTP.dat") == true) && (File.Exists(Config.GetPath() + "OPT10059_2_2_FTP.dat") == true) && (File.Exists(Config.GetPath() + "OPT10080_FTP.dat") == true) && (File.Exists(Config.GetPath() + "OPT10081_FTP.dat") == true) ) { //FileInfo[] fileList = directorySelected.GetFiles(startsWithZip + "*" + endsWithZip + ".zip"); FileInfo[] fileList = directorySelected.GetFiles("*.zip"); //모든 zip파일을 옮기자 foreach (FileInfo file in fileList) { bool ret1 = ftpUtil.Upload("/home/jijs/rubytest/mysqloader/data", file.FullName); FileLog.PrintF("UploadEosFiles ftpUtil.Upload=>" + file.Name + "_" + ret1.ToString()); if (ret1 == true) { FileLog.PrintF("UploadEosFiles path\\BACKUP=>" + Config.GetBackUpPath()); FileLog.PrintF("UploadEosFiles file.FullName=>" + file.FullName); FileLog.PrintF("UploadEosFiles file.Name=>" + file.Name); File.Move(file.FullName, Config.GetBackUpPath() + file.Name); } } /* bool ret2 = ftpUtil.Upload("/home/jijs/rubytest/mysqloader/data", checkFile.FullName); FileLog.PrintF("UploadEosFiles ftpUtil.Upload=>" + checkFile.Name + "_" + ret2.ToString()); if (ret2 == true) { File.Delete(checkFile.FullName); } */ } }