473,387 Members | 1,569 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.

Copying Files in VB6

Ali Rizwan
925 512MB
Hello everybody.
I have a problem in fso.copyfiles in vb6.0.Please help me in copying files and how to rename them.
Thanks
Aug 16 '07 #1
11 7637
pureenhanoi
175 100+
Hello everybody.
I have a problem in fso.copyfiles in vb6.0.Please help me in copying files and how to rename them.
Thanks
Expand|Select|Wrap|Line Numbers
  1. Name "d:\file1.txt" As "c\file2.txt"
  2.  
Aug 17 '07 #2
fplesco
82
Hello everybody.
I have a problem in fso.copyfiles in vb6.0.Please help me in copying files and how to rename them.
Thanks
Hey -

You can also try it.

This code will copy a file, and of the same time, will rename a file.

Expand|Select|Wrap|Line Numbers
  1. FileCopy "C:\<SourceFolder>SourceFile.txt","C:<DestinationFolder>\DestinationFile.txt"
  2.  
Aug 17 '07 #3
Killer42
8,435 Expert 8TB
I have a problem in fso.copyfiles in vb6.0.Please help me in copying files and how to rename them.
What sort of problem?
Aug 17 '07 #4
Ali Rizwan
925 512MB
What sort of problem?
Thanks for reply
i am using this code
Set f = fso.CopyFile("D:\Ali.txt", "D:\Ali\Ali.txt")
and the error is
Expected Function or Variable
Aug 17 '07 #5
Ali Rizwan
925 512MB
Hey -

You can also try it.

This code will copy a file, and of the same time, will rename a file.

Expand|Select|Wrap|Line Numbers
  1. FileCopy "C:\<SourceFolder>SourceFile.txt","C:<DestinationFolder>\DestinationFile.txt"
  2.  
Thanks for reply
I use and an error of syntax error.
Some times i got an error of =expected
Aug 17 '07 #6
Ali Rizwan
925 512MB
Expand|Select|Wrap|Line Numbers
  1. Name "d:\file1.txt" As "c\file2.txt"
  2.  
Thanks for reply.
Can you explain it to me. plzzzz
Aug 17 '07 #7
Killer42
8,435 Expert 8TB
Set f = fso.CopyFile("D:\Ali.txt", "D:\Ali\Ali.txt")
and the error is
Expected Function or Variable
That's because you're trying to assign something to a variable (f). Don't do that, just execute the CopyFile. Leave off the "Set f =".
Aug 18 '07 #8
Killer42
8,435 Expert 8TB
I use and an error of syntax error.
Some times i got an error of =expected
That probably means you're putting parentheses around the parameters. If you code it exactly as shown, I think it will work.
Aug 18 '07 #9
Killer42
8,435 Expert 8TB
Can you explain it to me. plzzzz
What is there to explain? That's the whole of it. The Name x As y command renames a file (and if necessary, moves it to a different folder). Look it up in your VB doco.

It's important to note, though, that this doesn't copy - it moves. Big difference!
Aug 18 '07 #10
Ali Rizwan
925 512MB
That probably means you're putting parentheses around the parameters. If you code it exactly as shown, I think it will work.

OK
I try it and it works properly.
I am thakfull to you for this.
Now only one question more.
When using statement
copyfile is there no need of fso or yes.

Thanks a lot again
Aug 18 '07 #11
Killer42
8,435 Expert 8TB
I try it and it works properly.
I am thakfull to you for this.
Now only one question more.
When using statement
copyfile is there no need of fso or yes.
Glad to see you got it working. :)

As for the fso question, I don't know. My guess would be that you do need the fso reference, as FileCopy is a method of the fso. However, my general advice is - "if in doubt, try it out".
Aug 22 '07 #12

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

Similar topics

3
by: Robert Tarantino | last post by:
Hello, I am trying to find a way to create a scheduled task or service that will copy my local profile folders under "Documents and settings" to a network drive. This would allow me to restore...
4
by: Alex Vinokur | last post by:
Copying files : input to output =============================== C/C++ Performance Tests ======================= Using C/C++ Program Perfometer http://sourceforge.net/projects/cpp-perfometer...
0
by: Dan | last post by:
We debug a VB.Net App that uses compact framework to a DAP Windows CE.Net device. When I debug I would like to only have the EXE copied down. Right now it copies any referrences as well and...
2
by: | last post by:
Hello, I have a program that starts a new thread to backup files from a computer over the network to our server. The problem is when it is copying the files you can hardly navigate around in...
10
by: Martin Ho | last post by:
I am running into one really big problem. I wrote a script in vb.net to make a copy of folders and subfolder to another destination: - in 'from.txt' I specify which folders to copy - in...
4
by: zMisc | last post by:
Is it possible to copy a table from one schema to another schema by just copying the frm file to the directory for the new schema? What is the best way to create a new database with all the...
6
by: Jim Heavey | last post by:
I have written a little application which copies files from one location to another location. Before it copies the file, it ensure the directory for both the from and to locations is valid. It...
2
by: Edhy Rijo [Progytech] | last post by:
Hi All, I am learning VB.NET and building small application that will do the following: 1.. Copy all files from a DVD to a specific folder in the hard drive and overwrite all files always. The...
6
by: kimiraikkonen | last post by:
Hi, I use system.io.file class to copy files but i have a difficulty about implementing a basic / XP-like progress bar indicator during copying process. My code is this with no progress bar,...
13
by: writeson | last post by:
Hi all, I'm writing some code that monitors a directory for the appearance of files from a workflow. When those files appear I write a command file to a device that tells the device how to...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.