• [C#常用代码]如何把指定文件夹中的文件移动到指定的文件夹


    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.IO;
    
    namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                string strPath = Application.StartupPath +"\"+ "path" + "\";
                if (!Directory.Exists(strPath))
                {
                    Directory.CreateDirectory(strPath);
                }
                string strFilePath = strPath + "a.xml";
    
                string strPathSuccess = Application.StartupPath +"\"+ "pathSuccess" + "\";
                if (!Directory.Exists(strPathSuccess))
                {
                    Directory.CreateDirectory(strPathSuccess);
                }
                string strFilePathSuccess = strPathSuccess + "a.xml";
                //File.Move(strFilePath,strFilePathSuccess);
                //textBox1.Text="D:wenjianjiaa.xml"
                File.Move(strFilePath, @textBox1.Text);
                MessageBox.Show("Success");
            }
        }
    }
  • 相关阅读:
    freemarker报错之五
    freemarker处理空值
    freemarker报错之四
    freemarker之include指令
    freemarker之list
    freemarker报错之三
    freemarker中的if...elseif...else语句
    freemarker获取封装类中对象的属性
    单块读和多块读操作汇总
    freemarker报错之二
  • 原文地址:https://www.cnblogs.com/beeone/p/3993552.html
Copyright © 2020-2023  润新知