473,785 Members | 2,275 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

moving subfolders

using visual studio 2005, framework 2.0, winXP SP2
I have a winform with two text-boxes, both associated with a folder
browser dialog (no problem with this), and a button.
First text-box has the origin folder, and the other points to the
destination one.
Aditionally, I have a "backup" folder.
The CONTENT of the origin folder is copied into destination's. But
first, I have to move all the destination content to a new subfolder
inside "backup".
When I'm talking of the Content of a folder, I'm meaning all the
archives and subfolders (with all its content) inside that folder.
The problem is when I try to move destination content to the newly
created subfolder (inside backup), Destination folder disappears.
This is the code (very simple as you may see)

Imports System.IO
Imports System.Diagnost ics
// not using other references

Directory.Creat eDirectory(Back upSubFolder)
//created inside BackupFolder (no problem with this)
If Directory.Exist s(destinationFo lder) Then
// destination content is moved here. But after this,
destinationFold er disappears...
Directory.Move( destinationFold er, BackupFolder)
Else
MessageBox.Show ("BackupSubFold er Not Created")
End If
Jul 22 '08 #1
4 1803
I need to clarify something. The line
Directory.Creat eDirectory(Back upSubFolder) is useless, in fact.
Because when you try
Directory.Move( destinationFold er, BackupFolder), BackupFolder is
created, if not before. And if it already exists, a proper exception
is launched.
But the main problem still remains: Why destinationFold er disappears,
in spite of its content appear inside BackupFolder?
I want destinationFold er remains intact. Empty, without its content
now moved to backupFolder, but without disappearing.
Jul 22 '08 #2
Directory.Move( destinationFold er, BackupFolder)

This is expected as you *move* the folder (i.e. you take it from one place
and put it at some other place)

You want likely to *copy* the folder instead :
http://msdn.microsoft.com/en-us/library/xz2d9afk.aspx

--
Patrice


Jul 22 '08 #3
Ah ! So what you want is to move the *content* of this folder (of course you
can use GetFiles/GetDirectories to get the content)...

--
Patrice
"fixertool" <re********@gma il.coma écrit dans le message de groupe de
discussion :
8d************* *************** **...legroups .com...
I need to clarify something. The line
Directory.Creat eDirectory(Back upSubFolder) is useless, in fact.
Because when you try
Directory.Move( destinationFold er, BackupFolder), BackupFolder is
created, if not before. And if it already exists, a proper exception
is launched.
But the main problem still remains: Why destinationFold er disappears,
in spite of its content appear inside BackupFolder?
I want destinationFold er remains intact. Empty, without its content
now moved to backupFolder, but without disappearing.

Jul 22 '08 #4
Thanks for your kind response. I'll see this later. And I'll post my
solution.

Ah ! So what you want is to move the *content* of this folder (of
course you
can use GetFiles/GetDirectories to get the content)...
Jul 23 '08 #5

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

Similar topics

1
4297
by: Kris | last post by:
Question: How do you create an Installer program using the Package and Deployment Wizard provided by Visual Studio Pro 6.0 (SP5) to include subfolders and their contents. I understand how to include each file, individually, but I would like to have the program install them into their appropriate folders. More Information: I have a small VB app (VB6 Pro, SP5 on Win NT4) for which I would like to create a Standard Setup Package...
9
9433
by: Tom | last post by:
How do you programatically get a list of subfolders in a folder? Thanks! Tom
3
1950
by: TK | last post by:
Excuse me for multiple posting because I've posted this message to aspnet.security NG but have not got any response yet. I'm building an ASP.NET application works in Forms Authentication mode with custom user account database. And it shows clients a list of hyperlinks to content pages located in some separated subfolders. This application and content pages are entirely secured, so everyone must logon to the application. The application...
9
19009
by: Bill Nguyen | last post by:
I need a VB routine to loop thru a select top folder to find all subfolders and list all subfolders/files under each of these subfolders. Any help is greatly appreciated. Bill
8
2140
by: John Dann | last post by:
Just getting started with VB2005 and unsure how best to move active VB2003 projects into the VB2005 environment. Nornally I've versioned my VB2003 projects at specific development points by starting a new (blank) project and using Add Existing Item to import all the files from the previous project version before saving in a new folder location belonging to the new project. But on doing this in the VB2005 environment I find I've got a...
4
1919
by: Martin | last post by:
Hi! How do I move a project (all sources) to a different location. Currently it is located in 'My Documents', but I would like to move it to a directory on the server. When I try the "Save As..." option on the vbproj-file, VS2005 tells me that it can be in the current directory only... Tia, Martin
9
2765
by: OWeb | last post by:
Javascript and recursing subfolders assistance ------------------------- I have this script that is a free extra download from SlideShowPro. It's a great script but I feel it needs to be tweaked a bit and need some assistance. The script is not mine, it is actually: Copyright 2007 (c) Dominey Design Inc. All Rights Reserved. (I don't want anybody thinking I'm taking credit for the script.) Here's what it does and what it should do...
0
1430
by: Artie | last post by:
I have moved SQL 2000 to new hardware several times following various 'approved' procedures with success. I have a customer who did the following and it seems to work (although very minimal testing has been done): 1) SQL 2000 was installed to new machine from CD 2) stopped SQL services on new and old machine 3) COPIED \Program Files\Microsoft SQL Server and all subfolders (all dbs including master, model, tempdb, user dbs, etc) 4) shut...
2
12805
by: pbrown | last post by:
Hey All, My problem appears to be pretty simple. I need a way of listing all the folders that exist in a certain directory. By all the folders, I mean ALL the folders; any file folder that exists underneath a certain directory needs to be returned, no matter how deep it lies. So, for example, 2 folders in drive X:, one called 'Names' the other called 'Addresses' 'Names' contains 3 different folders, each of which has 2 subfolders...
0
9489
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10357
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10101
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9959
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4063
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2893
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.