473,387 Members | 1,628 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 a Directory

In VB.NET, is there any way to copy a directory and all its contents to a
new location using io.Directory or io.DirectoryInfo etc. without having to
import the Scripting.FileSystemObject?

io.Directory and DirectoryInfo only seem to have a Move command, but what
about copying?

Nov 21 '05 #1
3 1212
Phil,
You can use IO.File.Copy to copy a file.

I would use IO.Directory.GetDirectories to get the list of directories &
Directory.GetFiles to get the list of files in a directory. I would then use
Directory.CreateDirectory to "copy" the Directory entries & File.Copy to
copy each file.

Post if you would like a sample.

Hope this helps
Jay

"Phil Galey" <pa*****@starcalif.com.nospam> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
| In VB.NET, is there any way to copy a directory and all its contents to a
| new location using io.Directory or io.DirectoryInfo etc. without having to
| import the Scripting.FileSystemObject?
|
| io.Directory and DirectoryInfo only seem to have a Move command, but what
| about copying?
|
|
|
Nov 21 '05 #2
Hi Phil,

Here's a code sample to do just that:

http://www.gotdotnet.com/Community/U...1-2A2E1A0F5D37

Not downloaded it myself to check the code for you - sorry

Crouchie1998
BA (HONS) MCP MCSE
Nov 21 '05 #3
Phil,

Nobody prevents you to use XCopy in an application start.

Just my thought,

Cor
Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

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...
5
by: Bill Rust | last post by:
I have a component that needs to access files which exist in the same directory as the DLL containing the component itself. To determine the component's installation directory, I'm using...
5
by: Ian Davies | last post by:
Hello I am trying to use php to automate the copying of a file from my remotely hosted directory to my computer. I have put together the following but it will only do the copying from one...
3
by: John Bowman | last post by:
I need to copy a directory to another locaiton. Is there some .Net framework method I cannot find for copying a directory from 1 location to another? I found the File.Copy(), but there does not...
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...
17
by: Kerr | last post by:
Hi all, I am sure that this is quite simple but can't find any good examples anywhere. I need a method of copying multiple files from a source directory to a destination directory. The file...
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...
3
by: kiwi | last post by:
Hello: I have a DLL that must update into a server. I want to make automatic proccess that copy that dll from a directory(Ex: c:\update) to application directory (ex: c:\application). Copy file...
2
by: Alan Bak | last post by:
HI I am running Active Perl on a Windows XP machine. I am hoping to get some advise on a strategy to monitor and copy files that are arriving in a directory and need to be copied to a second...
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: 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: 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
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
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,...

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.