VB 复制文件 到指定共享文件夹下 VB复制文件夹中文件,以指定路径的文件夹中文件复制到另一个文...

VB\u4e2d\u600e\u4e48\u5c06\u4e00\u4e2a\u6587\u4ef6\u590d\u5236\u5230\u6307\u5b9a\u6587\u4ef6\u5939

Dim fs ' \u5148\u58f0\u660e\u4e00\u4e2a\u53d8\u4f53\u578b
Set fs = CreateObject("Scripting.FileSystemObject") '\u521b\u5efa\u6587\u4ef6\u7cfb\u7edf\u5bf9\u8c61fs
fs.copyfile "D:\copyto.txt", "E:\" '\u4f7f\u7528\u8be5\u5bf9\u8c61\u7684copyfile\u65b9\u6cd5\u5c06\u6e90\u6587\u4ef6\u590d\u5236\u5230\u76ee\u6807\u6587\u4ef6

VB6.0\u4f7f\u7528CopyFile \u65b9\u6cd5\u6765\u5b9e\u73b0\u628a\u4e00\u4e2a\u6216\u591a\u4e2a\u6587\u4ef6\u4ece\u4e00\u4e2a\u5730\u65b9\u590d\u5236\u5230\u53e6\u4e00\u4e2a\u5730\u65b9\u3002
CopyFile \u65b9\u6cd5\u3002
\u63cf\u8ff0\uff0c\u628a\u4e00\u4e2a\u6216\u591a\u4e2a\u6587\u4ef6\u4ece\u4e00\u4e2a\u5730\u65b9\u590d\u5236\u5230\u53e6\u4e00\u4e2a\u5730\u65b9\u3002
\u8bed\u6cd5\uff1a

\u8bf4\u660e
\u901a\u914d\u7b26\u53ea\u80fd\u7528\u5728 source \u53c2\u6570\u7684\u6700\u540e\u4e00\u4e2a\u8def\u5f84\u90e8\u4ef6\u3002\u4f8b\u5982\u4f60\u53ef\u4ee5\u5728\u4e0b\u9762\u8bf7\u51b5\u4f7f\u7528\u901a\u914d\u7b26\uff1a
FileSystemObject.CopyFile "c:\mydocuments\letters\*.doc", "c:\tempfolder\"
\u4f46\u4e0b\u9762\u60c5\u51b5\u4e0d\u80fd\u4f7f\u7528\uff1a
FileSystemObject.CopyFile "c:\mydocuments\*\R1???97.xls", "c:\tempfolder"
\u5982\u679c source \u5305\u542b\u901a\u914d\u7b26\u6216 destination\u4ee5\u8def\u5f84\u5206\u9694\u7b26\uff08\\uff09\u4e3a\u7ed3\u5c3e\uff0c\u5219\u8ba4\u4e3a destination\u662f\u4e00\u4e2a\u5df2\u5b58\u5728\u6587\u4ef6\u5939\uff0c\u5728\u5176\u4e2d\u590d\u5236\u76f8\u5339\u914d\u7684\u6587\u4ef6\u3002\u5426\u5219\u8ba4\u4e3a destination \u662f\u4e00\u4e2a\u8981\u521b\u5efa\u6587\u4ef6\u7684\u540d\u5b57\u3002\u4e0d\u8bba\u662f\u90a3\u79cd\u60c5\u51b5\uff0c\u5f53\u590d\u5236\u4e00\u4e2a\u6587\u4ef6\u65f6\uff0c\u53ef\u80fd\u53d1\u751f\u4e09\u79cd\u4e8b\u4ef6\u3002
1. \u5982\u679c destination \u4e0d\u5b58\u5728\uff0csource \u5f97\u5230\u590d\u5236\u3002\u8fd9\u662f\u901a\u5e38\u7684\u60c5\u51b5\u3002
2.\u5982\u679c destination \u662f\u4e00\u4e2a\u5df2\u5b58\u5728\u7684\u6587\u4ef6\uff0c\u5219\u5f53 overwrite \u503c\u4e3a False \u65f6\u53d1\u751f\u4e00\u4e2a\u9519\u8bef\uff0c\u5426\u5219\uff0csource\u7684\u590d\u5236\u6587\u4ef6\u5c06\u8bd5\u56fe\u8986\u76d6\u5df2\u5b58\u5728\u6587\u4ef6\u3002
3.\u5982\u679c destination \u662f\u4e00\u4e2a\u76ee\u5f55\uff0c\u53d1\u751f\u4e00\u4e2a\u9519\u8bef
\u5982\u679c\u4f7f\u7528\u901a\u914d\u7b26\u7684 source \u4e0d\u80fd\u548c\u4efb\u4f55\u6587\u4ef6\u5339\u914d\uff0c\u540c\u6837\u4ea7\u751f\u4e00\u4e2a\u9519\u8bef\u3002CopyFile \u65b9\u6cd5\u505c\u6b62\u5728\u5b83\u9047\u5230\u7684\u7b2c\u4e00\u4e2a\u9519\u8bef\u4e0a\u3002\u4e0d\u8981\u8bd5\u56fe\u56de\u5377\u6216\u64a4\u6d88\u9519\u8bef\u53d1\u751f\u524d\u6240\u505a\u7684\u4efb\u4f55\u6539\u53d8\u3002

假设你要复制到的文件夹是c:\file FileCopy commondialog1.filename "c:\file\" 就可以了。

扩展阅读:w7怎样解决oxcoooooof ... 共享文件夹 实时 同步 ... 安卓手机smb文件共享 ... vb剪切复制粘贴的程序代码 ... vb复制粘贴怎么写 ... 编程代码可复制粘贴 ... 复制局域网共享 会被发现 ... vs调试系统找不到指定文件 ... vbs 系统找不到指定文件 ...

本站交流只代表网友个人观点,与本站立场无关
欢迎反馈与建议,请联系电邮
2024© 车视网