Hi
I am severely struggling with even the basics of this part of my project.
I have a destination path in a variable, selected via the
FolderBrowserDialog function, and this works fine.
I have a ArrayList of source paths, mixed folders and files.
eg a file as C:\My Documents\TextFile.txt
eg Folder as C:\My Documents\Folder1
I am trying to copy each item as follows: if it is a file, copy to destination folder, if it exists, overwrite.
If a folder, if the folder exists in destination, then copy everything in source to destination folder, overwrite if already existing.
If folder doesn't already exist in destination, then create and then copy everything as above.
I have tried a bunch of things, using File.Copy and
My.Computer.FileSystem.CopyDirectory but have had a myriad of different errors - too many to list here.
One typical error arises when the CopyDirectory, which at the time appears to have the correct paths etc, goes ahead and creates a file instead of a folder, with the correct name etc
I have used
Function FileOrFolder(ByVal path As String) As Boolean
If (File.GetAttributes(path) And FileAttributes.Directory) Then Return True Return False End FunctionThis does return the correct true/false and the calling routine does process this correctly.
I have found lots of information in the help system, but unfortunately, the area causing the problems seems to have only definitions rather than examples. And, the MS example I downloaded (a recursive routine) is difficult to understand as it uses a lot of advances code handling to return/concatenate/combine elements which I can't follow easily. (WorkingWithTheFileSystem.sln)
Is there such a thing as a simplified code subroutine that has source and destination paths as input parameters and does the copying using those
Sorry for being long winded, but I am also struggling to explain it.

Newbie - File copying confusion
Gert-Jan van der Kamp
Hmmm ....... tell me more, I had marked two small words as Bold. Is that what you mean I didn't change anything else at all.
I have seen some previous posts (including one of my own) where the actual font size was huge - I mean 1" tall on my screen. The one of my own which displayed like that was not of my doing either.
Something else is causing that to happen.
btw all of the posts in this thread are appearing OK for me right now!
Rags707
Well, since it appears to be just as difficult to post on this forum as it is to learn VB, I will refrain from posting.
If the tools provided for use in the post editor are causing this I will not use them.
From what you say, a lot of my posts have been 'corrupted', yet I have only seen one of my postings screwed up in some way. (Have seen others though)
Beats me. Seems MS need to error check their forum code. As for cutting/pasting, well, I was having problems with that too, I think there is a previous post of mine saying that somewhere.
Michael Ingmar Staib
I am at a loss.
The post that prompted your remarks displayed fine here, I didn't change any font sizes at all in that posting. In fact, I have never changed the font sizes in any of my postings. The only changes to 'standard' that I have ever made to any post is setting bold and changing the font colour (when it continues as a blue colour after pasting a bit of cose or such).
As I said, the only changes I made were 2 words set to bold. I can't 'sort the fonts out' if I didn't change them in the first place.
I am thinking that you should direct your comments to the forum management.
I have noticed in my short time on the forum, that there are a few strange things that seem to happen, Your point about the strange font thing being one of them. I also experienced a post edit window without any word wrap, and other oddities too.
Why the usual right click copy/paste doesn;t work is another that I class as an 'oddity'.
Andres Ponce de Leon
Thanks Trucker
Got me going in the right direction. Managed to get your snippet working fine.
I think that some of my problems revolve around the fact that my list of items to be copied consist entirely of absolute paths including filenames (if not a directory)
From your example, I think I will need to break these down into either single file names, single folder names and absolute paths without names on the end - at least, that's the way I'm thinking at the moment.
I'll get to work a little later and see what I can do.
deltwebguy
I have had a little bit of success, dealing with the folder copy side of things first.
I set this up:
Private Sub BackUp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BackUp.Click' DestFolder = c:\TestFolder\TestFolder2
Dim s1 As String = DestFolder.Text
Dim s2 As String = Nothing
For Each s2 In BackUpFileList If FileOrFolder(s2) Then My.Computer.FileSystem.CopyDirectory(s2, s1, True) End If Next End SubThis works, but I need to figure out how to copy a folder amd all contents to a new folder of same name created in the destination. The above doesn't create the new folder inside destination first - just copies the contents into destination.
This seems to be contrary to the (CopyDirectory) Help which suggests to me that it will create the new folder first. Do I need to strip off the source folder name and append that to the destination path as well
Bakhytzhan
No the fonts are all over the place. They are like that on a lot of your posts. Its the forums stuff that is really doing much of the funkiness.
What I would do is I write my reply in something like notepad (or even if you write it in the post window - cut/paste it into notepad and then cut/paste it back which causes it to loose all formatting info) as then I know all the formatting is the same. If you then select the entire text in you post and set the font style to Normal eveything should be ok.
This using notepad also works nicely when cutting code examples and it appears to double line space them. using notepad pasted code doesnt do this.
You can select the entire text and determine a font style and font size and then just highlight the relevent items.
Talepinner
It wasnt stop posting - it was just try and sort the fonts out.
Mohan Radhakrishnan
Can you stop change the font so the text is in the normal size.
Just do a selected all and set font size to normal.
It makes it much easier to read - rather than having font size changes everywhere.
drosselo
Sorry it got somewhat confused.
It is rather annoying how the formats on posts get screwed up and you have to do this little step but it makes it so much easier to read the code.
But do keep posting.....
ShadowRaven
Don't stop posting here. What is being seen is some of the Font sizes are rather large. But, it is not just your posts that I have seen that way. I can post in a particular font size and sometimes it will be smaller than I see as what I type. As for the Copy/Pasting thing, just remember the little Clipboard thing in the editor window here. I was so used to doing a Right Click and Selecting Paste that It didn't dawn on me at first to use that to paste what I had copied to the clipboard ( Duh!!)
I also think that some of the problems that people have is because they have their fonts set in IE ( or whatever they use for browsing) to a larger size. I do, because of vision problems.
james
aka:Trucker
Edit, you know what, I think I know the problem!!!!! I am betting you have your font size set fairly large in VB2005 EE's code editor! ( which I do at times) And what is happening ( and has happened to me) is when you paste some code you have copied from VB to here, and then type some text below that, the font size of the code you have pasted is carried over to the text you are now typing. ( even the text color too) If you look at a couple of posts of mine with code snippets posted, and the End Sub is in Blue Letters ( from VB code Editor) then anything I typed after that is in blue too!! Same thing would go for the Font size too. I noticed that on one of my last posts and changed the text color and it looked better. I bet that is what is going on!!!! ( 2-points fo me)
web_dev_caci
Hey Trucker,
I missed your post in the rush. re: large font in VB code editor.
You are right, I do run the various elements of the VB environment at a larger font size. My eyes can't cope with a 19xx by 1600 monitor resolution for such things. Graphics are good though :)
In fact, I use Opera browser (where possible) in preference to IE because IE only allows 'Largest' fonts and they are a little too small still for me. Unfortunately, MS sites don't agree with Opera so I am stuck with IE for posting in this forum. I know, I can reduce my monitor resolution, but I don't :)
You earned your 2 points - thanks.
Dave_Novak
I would probably think you are cutting/pasting code directly from the tool. This is bringing in formating info from that.
I know the problem exists which is why I am saying if you cut/paste this into notepad it remove the formating and then cut/paste this from notepad into your post it then ensures you text you type and you code samples are all in the same size font etc.
Otherwise I'm seeing you code snippets in Extra large and your comments in normal.
Sure its irritating just like when you cut code and it appears to double line space when entered into the post. And yes this has been mentioned to the forum management but I'm simply asking that you try and address it. Its something that takes a few extra seconds.
Its more a matter of etiquette - just like people that type all there stuff in CAPS or people that post questions in languages other than english in an english forum.
Right click Cut/Paste doesnt work but I always use Ctrl C + Ctrl V to copy and paste. Again you just get used to using these key combinations in all applications.
The last post was just fine.... I'm sure its just when you copy code that the fonts go all screwy.
samcneal
Check out CopyDirectory in Help. There is a short example that shows how to copy one folder and it's contents to another folder. Using the code sample , it will copy everything in a folder , incuding subfolders to another folder that you tell it to:
My.Computer.FileSystem.CopyDirectory("C:\TestDirectory1", "C:\TestDirectory2", True)vikedal
Ah, now I understand what you are meaning. I did not realise that you were talking about the format being screwed up by the cut/paste of code snippets.
Of course I will take steps to correct it now that I realise what not to do.
I did previously always use I always use Ctrl C + Ctrl V to get the code snippet into the forum, but if that is all that is causing the problem, I will go via notepad to stop causing this.
Thanks for finally explaining it to me.