469,921 Members | 2,252 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,921 developers. It's quick & easy.

how can i copy a text file and paste it in a specific path

how can i copy a text file and paste it in a specific path by VB6 code

another question
how can i create afolder in a specific path by VB6

thank you
Feb 28 '08 #1
7 2209
debasisdas
8,127 Expert 4TB
Try to use FileSystemObject.
Feb 28 '08 #2
jamesd0142
469 256MB
Expand|Select|Wrap|Line Numbers
  1. Dim fso As New FileSystemObject
  2. fso.CopyFile "C:\Files\file.txt", "C:\Files1\file_copy.txt" 
  3.  
to create mayb something like fso.createdirectory?

I think this will do it.

James
Feb 28 '08 #3
debasisdas
8,127 Expert 4TB
try using this

MkDir "d:\debasisdas"

for creating a directory.
Feb 28 '08 #4
debasisdas
8,127 Expert 4TB
If you want to move the file to another location then try this

Expand|Select|Wrap|Line Numbers
  1. Dim FSO As FileSystemObject
  2. Set FSO = CreateObject("Scripting.FileSystemObject")
  3. FSO.MoveFile "E:\DEBASIS\VB\DATA1.TXT", "E:\DEBASIS\DATA1.TXT"
  4.  
  5. 'or try to use 
  6.  
  7. Dim FSO As FileSystemObject, FO As FileSystemObject
  8. Set FSO = CreateObject("Scripting.FileSystemObject")
  9. Set FO = FSO.GetFile("E:\DEBASIS\VB\DATA1.TXT")
  10. FO.Move "E:\DEBASIS\DATA1.TXT"
  11.  
Feb 28 '08 #5
Expand|Select|Wrap|Line Numbers
  1. Dim fso As New FileSystemObject
  2. fso.CopyFile "C:\Files\file.txt", "C:\Files1\file_copy.txt" 
  3.  
to create mayb something like fso.createdirectory?

I think this will do it.

James
this code cause this error
compile error
user-defined type not defined
Feb 28 '08 #6
If you want to move the file to another location then try this

Expand|Select|Wrap|Line Numbers
  1. Dim FSO As FileSystemObject
  2. Set FSO = CreateObject("Scripting.FileSystemObject")
  3. FSO.MoveFile "E:\DEBASIS\VB\DATA1.TXT", "E:\DEBASIS\DATA1.TXT"
  4.  
  5. 'or try to use 
  6.  
  7. Dim FSO As FileSystemObject, FO As FileSystemObject
  8. Set FSO = CreateObject("Scripting.FileSystemObject")
  9. Set FO = FSO.GetFile("E:\DEBASIS\VB\DATA1.TXT")
  10. FO.Move "E:\DEBASIS\DATA1.TXT"
  11.  
this code cause this error
compile error
user-defined type not defined
Feb 28 '08 #7
Killer42
8,435 Expert 8TB
this code cause this error
compile error
user-defined type not defined
You need to add a reference to Microsoft Scripting Runtime to your project.
Feb 29 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Faith | last post: by
reply views Thread by Tess | last post: by
3 posts views Thread by Rachel Suddeth | last post: by
7 posts views Thread by lgbjr | last post: by
6 posts views Thread by Ben R. | last post: by
17 posts views Thread by Steve | last post: by
reply views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.