开发者

Move file from one folder to a different folder in VB6

开发者 https://www.devze.com 2023-01-21 00:25 出处:网络
I have a number of files in a give folder A. I want to move these files to folder B one by one. i.e., I am doing processing to every file.开发者_C百科 so after my own processing completes, I want to m

I have a number of files in a give folder A. I want to move these files to folder B one by one. i.e., I am doing processing to every file.开发者_C百科 so after my own processing completes, I want to move the processed file to a different folder. How can I do that? Please help!


The pure VB6 approach, without using FileSystemObject, is to copy then delete.

FileCopy src, dest
Kill src

Links to manual:

http://msdn.microsoft.com/en-us/library/aa243368(VS.60).aspx

http://msdn.microsoft.com/en-us/library/aa243388(VS.60).aspx


you can actually use the name function for moving files using VB

Name "c:/test1.txt" as "d:/temp/blabla.txt"


You probably want the FileSystemObject:

https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-1050078.html


Also, obviously you should upgrade and avoid any new vb6 development if possible. If you are .NET enabled however, you can do it much more easily in a .NET library and then expose the .NET component to COM for reference by your VB6 app. The only new requirement would really be that the app requires the .NEt Framework (which is standard now for windows installations). Another benefit of this is that if you later decide to upgrade the app to .NET you already have this functionality done!

0

精彩评论

暂无评论...
验证码 换一张
取 消