zoukankan      html  css  js  c++  java
  • [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");
            }
        }
    }
  • 相关阅读:
    CADisplayLink
    对项目重命名
    TCP|UDP|Http|Socket
    CoreAnimation|动画
    Autolayout
    通讯录
    本地通知
    用于做 Android 屏幕自适应的文章资源
    Java String.format 自动补全不够的位数
    不同语言之间 日期格式转换
  • 原文地址:https://www.cnblogs.com/beeone/p/3993552.html
Copyright © 2011-2022 走看看