Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Display name of file being copied to UI using copyDir

Posted on 2011-09-02
3
Medium Priority
?
281 Views
Last Modified: 2013-12-17
Experts,

I have a C#  Win Form app that uses a background worker and copyDir to copy all the contents of one directory to another. When debugging the Output console prints a nice list of the current file being copied. I'd like to display this info to the user so they can see the progress in addition to the progress bar I'm using. Currently in my backgound worker DoWork method I have the following:

try
            {
                copyDir mycopy = new copyDir();
                myAnswer = mycopy.CopyAll(dir1, dir2);
               
            }
            catch
            {
                bwWork.CancelAsync();
                MessageBox.Show("Could not find thumb drive", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);

            }

Can this be done?

Thanks!
0
Comment
Question by:lateapex
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 32

Accepted Solution

by:
Robberbaron (robr) earned 2000 total points
ID: 36477567
what is the definition of the CopyDir class ?

it must be writing to Debug and probably can be moded to Copy to a status bar or similar.
(copyDirectory is part of System namespace.)
0
 
LVL 32

Expert Comment

by:Robberbaron (robr)
ID: 36477588
on the assumption you are using http://channel9.msdn.com/Forums/TechOff/257490-How-Copy-directories-in-C

you will see it has a Console.WriteLine(@"Copying {0}\{1}", target.FullName, fi.Name);

that writes the name of each file to the output window. If this were a console (ir command prompt app), you would see this is final product. But would be hard (at least for me) to modify so that it shows in a progress dialog.

http://www.codeproject.com/KB/files/Copy_files_with_Progress.aspx may be more what you are seeking as it appears to allow use of a special progress dialog that can display the full path and filename being actioned.
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

The canonical version of this article is on my web site here: http://iconoun.com/articles/collisions/ A companion presentation is available here: http://iconoun.com/articles/collisions/Unicode_Presentation.pdf
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
Viewers will learn the different options available in the Backstage view in Excel 2013.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

670 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