简单的程序来复制文件?如何? [英] Simple program to copy files? how to?

查看:80
本文介绍了简单的程序来复制文件?如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在表单上创建一个带有两个按钮的简单程序。


按钮1 - 备份PREFS

这将执行以下操作:

复制C:\Documents and Settings \%USERNAME%\ Application Data \ FileZilla

\ sitemanager.xml

到这个位置:\\drake \ pvt \%USERNAME%\ .FileZilla-Prefs \


BUTTON 2 - RESTORE PREFS

这样做会对面:

复制sitemanager.xml文件来自:\\drake \ pvt \%USERNAME%\ .FileZilla-Prefs

\并将其放在此处:

复制C:\Documents and Settings \%USERNAME%\ Application Data \ FileZilla \


我想不提示如果文件存在,只需覆盖...


谢谢

I want to create a simple program with Two buttons on the form.

BUTTON 1 - BACKUP PREFS
this will do the following:
Copy C:\Documents and Settings\%USERNAME%\Application Data\FileZilla
\sitemanager.xml
to this location: \\drake\pvt\%USERNAME%\FileZilla-Prefs\

BUTTON 2 - RESTORE PREFS
this will do the opposite:
copy sitemanager.xml file from: \\drake\pvt\%USERNAME%\FileZilla-Prefs
\ and put it here:
Copy C:\Documents and Settings\%USERNAME%\Application Data\FileZilla\

And I would like to to not prompt if files exists, just overwrite...

thanks

推荐答案

9月16日9:15 * pm,Jason< paul ... @ excite.comwrote:
On Sep 16, 9:15*pm, Jason <paul...@excite.comwrote:

我想创建一个简单的程序,表格上有两个按钮。


按钮1 - 备份PREFS

这将执行以下操作:

复制C :\Documents and Settings \%USERNAME%\ Application Data \ FileZilla

\ sitemanager.xml

到这个位置:\\drake \ pvt \%USERNAME%\ .FileZilla-Prefs \


BUTTON 2 - RESTORE PREFS

这样做会相反:

复制sitemanager.xml文件来自:\\drake \ pvt \%USERNAME%\ .FileZilla-Prefs

\并将其放在此处:

复制C:\Documents and Settings \%USERNAME%\ Application Data \ .FileZilla \


我想不提示文件是否存在,只是覆盖.. 。


谢谢
I want to create a simple program with Two buttons on the form.

BUTTON 1 - BACKUP PREFS
this will do the following:
Copy C:\Documents and Settings\%USERNAME%\Application Data\FileZilla
\sitemanager.xml
to this location: \\drake\pvt\%USERNAME%\FileZilla-Prefs\

BUTTON 2 - RESTORE PREFS
this will do the opposite:
copy sitemanager.xml file from: \\drake\pvt\%USERNAME%\FileZilla-Prefs
\ and put it here:
Copy C:\Documents and Settings\%USERNAME%\Application Data\FileZilla\

And I would like to to not prompt if files exists, just overwrite...

thanks



喜欢这个关于通过覆盖复制文件的帖子:
http://groups.google.com/group/micro...239d3c2?hl=en#


你可以简单地使用,

My.Computer.Filesystem.CopyFile(sourcePath,destPat h,True)


...并确保你拥有复制到目标UNC目的地的权利

不得像访问被拒绝这样的例外。


有关详细用法的更多信息:
http://msdn.microsoft。 com / en-us / libr ... yf(VS.80).aspx


希望这会有所帮助,


OnurGüzel

Like this thread about copying files by overwriting:
http://groups.google.com/group/micro...239d3c2?hl=en#

You can simply use,
My.Computer.Filesystem.CopyFile(sourcePath,destPat h,True)

...and make sure you have the right to copy to target UNC destination
not to get an exception like "access is denied".

For more info on detailed usage:
http://msdn.microsoft.com/en-us/libr...yf(VS.80).aspx

Hope this helps,

Onur Güzel


9月16日,2:15 * pm,Jason< paul ... @ excite.comwrote:
On Sep 16, 2:15*pm, Jason <paul...@excite.comwrote:

我想用表格上的两个按钮创建一个简单的程序。


按钮1 - 备份PREFS

这将执行以下操作:

复制C:\Documents and Settings \%USERNAME%\ App lication Data\FileZilla

\ sitemanager.xml

到这个位置:\\drake \ pvt \%USERNAME%\ FileZilla-Prefs \


BUTTON 2 - RESTORE PREFS

这将做相反的事情:

复制sitemanager.xml文件来自:\\ drake \pvt \%USERNAME%\ .FileZilla-Prefs

\并将其放在此处:

复制C:\Documents and Settings \%USERNAME% \Application Data \ .FileZilla \


我想不提示文件是否存在,只是覆盖...


谢谢
I want to create a simple program with Two buttons on the form.

BUTTON 1 - BACKUP PREFS
this will do the following:
Copy C:\Documents and Settings\%USERNAME%\Application Data\FileZilla
\sitemanager.xml
to this location: \\drake\pvt\%USERNAME%\FileZilla-Prefs\

BUTTON 2 - RESTORE PREFS
this will do the opposite:
copy sitemanager.xml file from: \\drake\pvt\%USERNAME%\FileZilla-Prefs
\ and put it here:
Copy C:\Documents and Settings\%USERNAME%\Application Data\FileZilla\

And I would like to to not prompt if files exists, just overwrite...

thanks



我会在System.I命名空间中使用FIle类。具体来说,带有重载的File.Copy方法带来了第三个参数,

布尔值指定是否覆盖。

I would use the FIle Class in the System.I namespace. Specifically,
the File.Copy method with the overload that takes a third parameter, a
boolean that specifies to overwrite or not.


这是我试过的:

My.Computer.FileSystem.CopyFile(" c:\Documents and Settings \ user

\ Application Data \ Adob​​e \InDesign\Version 5.0 \ InCopy TextMacros",_

" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ >

我得到了:由于目录已经存在,无法完成操作
此路径中的
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ '。


我如何在路径中执行%username%变量,这样它对现有用户只能工作



9月16日,3:27 * pm,za ... @ construction-imaging.com写道:
Here is what I tried:
My.Computer.FileSystem.CopyFile("c:\Documents and Settings\user
\Application Data\Adobe\InDesign\Version 5.0\InCopy TextMacros", _
"\\drake\home\user\text", True)

I get a: Could not complete operation since a directory already exists
in this path ''\\drake\home\user\text''.

also how do I do a %username% variable in the path so it only works
for current user?
On Sep 16, 3:27*pm, za...@construction-imaging.com wrote:

9月16日,2:15 * pm,Jason < paul ... @ excite.comwrote:
On Sep 16, 2:15*pm, Jason <paul...@excite.comwrote:

我是在表单上创建一个带有两个按钮的简单程序。
I want to create a simple program with Two buttons on the form.


BUTTON 1 - BACKUP PREFS

这将执行以下操作:

复制C: \Documents and Settings \%USERNAME%\ Application Data \ FileZilla

\ sitemanager.xml

到这个位置:\\drake \ pvt \%USERNAME%\ FileZilla-Prefs
BUTTON 1 - BACKUP PREFS
this will do the following:
Copy C:\Documents and Settings\%USERNAME%\Application Data\FileZilla
\sitemanager.xml
to this location: \\drake\pvt\%USERNAME%\FileZilla-Prefs


BUTTON 2 - RESTORE PREFS

这将做相反的事情:

复制sitemanager.xml文件:\\drake \ pvt \%USERNAME%\ .FileZilla-Prefs

\并将其放在此处:

复制C:\Documents and Settings \%USERNAME%\ Application Data \ FileZilla
BUTTON 2 - RESTORE PREFS
this will do the opposite:
copy sitemanager.xml file from: \\drake\pvt\%USERNAME%\FileZilla-Prefs
\ and put it here:
Copy C:\Documents and Settings\%USERNAME%\Application Data\FileZilla


我想不提示文件是否存在,只是覆盖...
And I would like to to not prompt if files exists, just overwrite...


谢谢
thanks



我会在系统中使用FIle类我是名字即具体来说,使用带有第三个参数的重载的File.Copy方法,

指定要覆盖的b / b bolean布尔值。


I would use the FIle Class in the System.I namespace. Specifically,
the File.Copy method with the overload that takes a third parameter, a
boolean that specifies to overwrite or not.


这篇关于简单的程序来复制文件?如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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