如何在Windows Applocation中将zip文件从一个位置复制到另一位置 [英] How to copy zip file from one location to another location in windows applocation

查看:91
本文介绍了如何在Windows Applocation中将zip文件从一个位置复制到另一位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,我从本地驱动器浏览zip文件.我希望它应该在"D:\\"之类的特定位置存储或复制.以下是我的代码

In my project i browse zip file from local drive. i want it should be store or copy on specific location like "D:\\". Below is my code

private void button2_Click(object sender, EventArgs e)
       {
           OpenFileDialog open1 = new OpenFileDialog();
           // file filters
           open1.Filter = "Document Files(*.RAR)|*.RAR";
           if (open1.ShowDialog() == DialogResult.OK)
           {

               // document file path
               txtdocumentuploda.Text = open1.FileName;

           }
       }

推荐答案

请参见以下小片段:
See this small snippet:
System.IO.File.Copy("C:\\Temp\\Test.zip", "D:\\Test.zip");


复制文件非常简单:
http://www.dotnetperls.com/file-copy [
Copying file is rather simple:
http://www.dotnetperls.com/file-copy[^]

using System;
using System.IO;

class Program
{
    static void Main()
    {
    // Figure 1
    // Copy one file to a non-existent location
    File.Copy("file-a.txt", "file-new.txt");

    // Display the contents of both files
    Console.WriteLine(File.ReadAllText("file-a.txt"));
    Console.WriteLine(File.ReadAllText("file-new.txt"));
    }
}


这篇关于如何在Windows Applocation中将zip文件从一个位置复制到另一位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆