示例#1
0
        public static void Archive(string strBatch, string strRun)
        {
            //string strFilePath = "\\\\Cobmain\\usacms\\PODFO\\Output\\mergedPDFs";
            string strBatchPath = strBatchPathP + strBatch + strRun;

            if (!Directory.Exists(strBatchPath))
            {
                DirectoryInfo di = Directory.CreateDirectory(strBatchPath);
            }

            Log("I", string.Format("Archive Start for Batch: {0} Run: {1}", strBatch, strRun));
            string[] fileEntries = Directory.GetFiles(strBatchPath);
            string   archive     = strBatchPath + "\\Archive " + DateTime.Now.ToString("MM-dd-yyyy HH mm ss");


            if (!Directory.Exists(archive))
            {
                DirectoryInfo di = Directory.CreateDirectory(archive);
            }

            foreach (string Fi in fileEntries)
            {
                File.Copy(Fi, archive + "\\" + Fi.Remove(0, Fi.LastIndexOf("\\") + 1));
            }
            foreach (string Fi in fileEntries)
            {
                File.Delete(Fi);
            }

            Log("I", string.Format("Archive End for Batch: {0} Run: {1}, Count: {2}",
                                   strBatch, strRun, fileEntries.Length.ToString()));
        }