473,387 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 2382
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

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

Similar topics

3
by: Faith | last post by:
Hello. I need to take a column from Excel(unknown amount of rows) that will be selected by the user and copy those cells. Then I will need to paste those cells into the first column in a Data...
0
by: Tess | last post by:
Hi, Long time reader, first time poster... Any help is appreciated. I have a few questions regarding Winform controls embedded within an html page. For more info please see the appendix. Now,...
5
by: tabonni | last post by:
Hello All I am creating an ASP page. There are a list of filename and checkbox next to it. When user checked all the documents they want and click ADD TO CLIPBOARD button. All filepaths will be...
3
by: Rachel Suddeth | last post by:
This may not be the right forum, but it's a problem I chiefly come across when trying to post here. When I do a copy/paste from VS, the text always looks really weird (and even if I'm in an...
5
by: DraguVaso | last post by:
Hi, I'm looking for a way to Copy and Paste Files to the clipboard. I found a lot of articles to copy pieces of text and bitmaps etc, but nog whole files. Whay I need is like you have in...
7
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard...
6
by: Ben R. | last post by:
Hi, I've got a vb.net winforms app. Out of the box, I can use Ctrl X, C and V as expected in controls like textboxes. I've got a menustrip, and if I click the link "Add standard items" which...
17
by: Steve | last post by:
I'm trying to code cut, copy, and paste in vb 2005 so that when the user clicks on a toolbar button, the cut/copy/paste will work with whatever textbox the cursor is current located in (I have...
2
by: ahmed222too | last post by:
when i use this code to copy a text file and paste it in a specific path: Dim fso As New FileSystemObject fso.CopyFile "C:\Files\file.txt", "C:\Files1\file_copy.txt" this error appear ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.