Click here to Skip to main content
15,890,527 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: How can I avoid multi-threading? Pin
Simon_Whale31-Jan-12 1:18
Simon_Whale31-Jan-12 1:18 
GeneralRe: How can I avoid multi-threading? Pin
Rick McLeod31-Jan-12 5:34
Rick McLeod31-Jan-12 5:34 
AnswerRe: How can I avoid multi-threading? Pin
Luc Pattyn31-Jan-12 1:58
sitebuilderLuc Pattyn31-Jan-12 1:58 
AnswerRe: How can I avoid multi-threading? Pin
Dave Kreskowiak31-Jan-12 2:13
mveDave Kreskowiak31-Jan-12 2:13 
AnswerRe: How can I avoid multi-threading? Pin
Bernhard Hiller31-Jan-12 20:55
Bernhard Hiller31-Jan-12 20:55 
QuestionAdd 3 columns from database to ComboBox Pin
ivo7530-Jan-12 8:38
ivo7530-Jan-12 8:38 
AnswerRe: Add 3 columns from database to ComboBox Pin
Simon_Whale30-Jan-12 8:50
Simon_Whale30-Jan-12 8:50 
QuestionVB 2010 code fails when copying root directory. Pin
KreativeKai30-Jan-12 2:30
professionalKreativeKai30-Jan-12 2:30 
I have a VB application I wrote in 2002 with Visual Studio 2002 at that time. It copies files and directories with a variety of parameters. We use the utility to copy files from server to server or destktop to desktop via scheduled tasks, etc.

It is a framework 1.0 app and has worked for years. This past year it was evident it needs upgraded to VS 2010. Everything is working fine except in Windows 7 with parameters we've used for years with XP and on the servers, when we copy a root directory, for example, D:\, the copy program will try to copy the Recycle Bin and the System Volume Information and fail. In previous operating systems I'm guessing it didn't try to copy these items, but in Windows 7 for some reason it does.

We really don't want to copy these two items anyhow, so in the new VS VB 2010 code I wrote the following logic, but I've found that from one server it isn't working:
<br />
Dim source as string = "D:\"<br />
Dim currentDirectory As DirectoryInfo = New DirectoryInfo(source)<br />
Dim di As DirectoryInfo<br />
For Each di In currentDirectory.GetDirectories()<br />
  If blnIsRoot = True Then<br />
    If (di.Attributes = FileAttributes.Normal) Or _<br />
       (di.Attributes = FileAttributes.Directory) Or _<br />
       (di.Attributes = FileAttributes.SparseFile) Or _<br />
       (di.Attributes = FileAttributes.ReparsePoint) Or _<br />
       (di.Attributes = FileAttributes.NotContentIndexed) Or _<br />
       (di.Attributes = FileAttributes.System) Or _<br />
       (di.Attributes = FileAttributes.Offline) Or _<br />
       (di.Attributes = FileAttributes.Temporary) Or _<br />
       (di.Attributes = FileAttributes.Device) Or _<br />
       (di.Attributes = FileAttributes.Hidden) Or _<br />
       (di.Attributes = FileAttributes.Encrypted) Or _<br />
       (di.Attributes = FileAttributes.Compressed) Or _<br />
       (di.Attributes = FileAttributes.Archive) Or _<br />
       (di.Attributes = FileAttributes.ReadOnly) Then<br />
<br />
           .... logic to copy directory<br />
<br />
end if statments, next statements, etc...<br />


With this code, it will copy a root directory (d:\) and all sub directories and ignore the recycle bin and system volume information.

Code works 99% of the time, but with one server which houses our intranet, I'm copying from \\inttranetserver\wwwroot\dept\its\ to d:\test\ and it is not copying any directories at all, even though there are multiple under ..\its\

I run the code in debug, set breakpoints and skip the if statement (shown above) checking attributes and it works fine, but put that if statment back in it doesn't copy any of the directories.

I'd like to use better logic, for example something that checks for "if recycle bin or if system volume information" but I haven't found anything.

Any suggestions? Confused | :confused:
Thanks
Lost in the vast sea of .NET

AnswerRe: VB 2010 code fails when copying root directory. Pin
Luc Pattyn30-Jan-12 2:45
sitebuilderLuc Pattyn30-Jan-12 2:45 
GeneralRe: VB 2010 code fails when copying root directory. Pin
KreativeKai30-Jan-12 3:09
professionalKreativeKai30-Jan-12 3:09 
AnswerRe: VB 2010 code fails when copying root directory. Pin
Luc Pattyn30-Jan-12 3:21
sitebuilderLuc Pattyn30-Jan-12 3:21 
GeneralRe: VB 2010 code fails when copying root directory. Pin
KreativeKai30-Jan-12 8:07
professionalKreativeKai30-Jan-12 8:07 
GeneralRe: VB 2010 code fails when copying root directory. Pin
Dave Kreskowiak30-Jan-12 4:25
mveDave Kreskowiak30-Jan-12 4:25 
GeneralRe: VB 2010 code fails when copying root directory. Pin
KreativeKai30-Jan-12 8:00
professionalKreativeKai30-Jan-12 8:00 
GeneralRe: VB 2010 code fails when copying root directory. Pin
Dave Kreskowiak30-Jan-12 8:10
mveDave Kreskowiak30-Jan-12 8:10 
GeneralRe: VB 2010 code fails when copying root directory. Pin
KreativeKai30-Jan-12 9:18
professionalKreativeKai30-Jan-12 9:18 
Questionvisual basic6.0 Pin
mahesh kagitha28-Jan-12 18:41
mahesh kagitha28-Jan-12 18:41 
AnswerRe: visual basic6.0 Pin
Richard MacCutchan28-Jan-12 21:40
mveRichard MacCutchan28-Jan-12 21:40 
GeneralRe: visual basic6.0 Pin
Gregory Gadow30-Jan-12 7:45
Gregory Gadow30-Jan-12 7:45 
AnswerRe: visual basic6.0 Pin
Eddy Vluggen30-Jan-12 7:47
professionalEddy Vluggen30-Jan-12 7:47 
AnswerRe: visual basic6.0 Pin
Abhinav S28-Jan-12 22:03
Abhinav S28-Jan-12 22:03 
AnswerRe: visual basic6.0 Pin
Luc Pattyn28-Jan-12 22:16
sitebuilderLuc Pattyn28-Jan-12 22:16 
GeneralRe: visual basic6.0 Pin
Richard MacCutchan28-Jan-12 22:26
mveRichard MacCutchan28-Jan-12 22:26 
GeneralRe: visual basic6.0 Pin
Luc Pattyn28-Jan-12 22:44
sitebuilderLuc Pattyn28-Jan-12 22:44 
GeneralRe: visual basic6.0 Pin
Bernhard Hiller29-Jan-12 20:51
Bernhard Hiller29-Jan-12 20:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.