Solved

Can I copy files (using the copy dialog) from one folder to another but...?

Posted on 2008-10-20
16
352 Views
Last Modified: 2010-04-21
...but I want to copy all the files in a folder from one folder to another - and it will only copy files w/ a newer lastWriteTime - and never promt the user - but it will show the copy dialog.

If
sfile.LastWriteTime > File.GetLastWriteTime(dest & sFile.Name) Then
sFile.CopyTo (Dest & sfile.name, true)


Something like that - but using the copy dialog show -
basically I want to copy from one folder to another - all the files
and I want it to show the progress -
and I want it to run on a thread of its own
Because I am running 4 folder copy subs at the same time.


When ever I use the file copy dialog - I get prompts - asking me if I want to overwrite YES YES to ALL and NO - something like that...
Any suggestions?
I posted earlier trying to make my own progress bars on the form -
but I am getting all kinds of errors trying to update objects on the form - because I am using threading to call the file copy.

Help - Please! haha
0
Comment
Question by:CanvasYou
  • 9
  • 5
  • 2
16 Comments
 
LVL 48

Expert Comment

by:jpaulino
ID: 22769609
Why don't you make your own progress form ? You just need to count the total of items and increment the progress bar on each one.
This way you can chek the dates/time and do the actions you want.
0
 

Author Comment

by:CanvasYou
ID: 22769645
You mean a progress form for each one?
I still would have a thread running - and have to call to update the objects - which are existing outside the thread - so it won't work...
well I can't get it to work - anyway.. haha - i have been playing w/ this for a few days now!
I am lost.
If you have any ideas I would appreciate it
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 22769676
>> You mean a progress form for each one?
Of course not! If you want to copy 10 files you create a new form with a progress bar on it and for each file copied you perform a step on the progress bar. Ok, if you have 1 huge file and 9 smaller you will not have a nice progress bar but you also don't have that on windows explorer (most of the times).
0
ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

 

Author Comment

by:CanvasYou
ID: 22769722
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 22771242
The problem is "and it will only copy files w/ a newer lastWriteTime" because the rest can be done.
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 22771245
That's why I have suggested that.
0
 

Author Comment

by:CanvasYou
ID: 22771282
"The problem is "and it will only copy files w/ a newer lastWriteTime" because the rest can be done."
I'm sorry - Can you explain more.. If you have the time.. thanks.
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 22771407
Let me do some tests and I show you some code snippet and solutions
0
 

Author Comment

by:CanvasYou
ID: 22771425
I appreciate it.
0
 

Author Comment

by:CanvasYou
ID: 22803113
The problem is - It has to run each file copy group on a new thread - and update the main form's progress bar.
http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_23829699.html
Please see what I am trying to do - anyone?
Help!
0
 
LVL 63

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 22807359
Hi CanvasYou;

Create four BackgroundWork's one for each Group and code it something like in the last post, http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_23847125.html.

Fernando
0
 

Author Closing Comment

by:CanvasYou
ID: 31508075
Thanks -
0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 22808048
Is there a reason why this solution is only worth a "B"?
0
 

Author Comment

by:CanvasYou
ID: 22808094
Because you pointed me to another post - that is not really specific to what I was looking for - it will work - but it was not the exact thing..
I appreciate it though - don't take it the wrong way!
0
 

Author Comment

by:CanvasYou
ID: 22808103
You solved it on the other post - but I was kinda asking 2 differnt things.
One was creating a custom progress bar - this one was to try to use the built in copy dialog.
and have it run copying only newer files - and update progress - using all windows built-in copy dialog w/o prompting...
does that make sense?
0
 

Author Comment

by:CanvasYou
ID: 22808104
I am a beginner at VB.net - that is obvious! I appreciate your help though - really.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question