Skip to main content
Tweeted twitter.com/StackCodeReview/status/884910858152714241
fixed copy/paste indentation, edited tags
Source Link
t3chb0t
  • 44.3k
  • 9
  • 84
  • 190

I have such problem : find all png files to disk and rename them as I did:

static void DirSearch(string sDir)
        {
            try
            {
                var images = Directory.GetFiles(sDir, "*.png");
                images.ToList().AsParallel().WithDegreeOfParallelism(100).ForAll(dd =>
               Rename(dd)
           );


            }
            catch { }

            try
            {
                foreach (string path in Directory.GetDirectories(sDir))
                        DirSearch(path);
            }
            catch (System.Exception excpt)
            {
                Console.WriteLine(excpt.Message);
            }

        }

Actually a question : whether it is optimized enough ? Need as quickly as possible to process all png files.

I have such problem : find all png files to disk and rename them as I did:

static void DirSearch(string sDir)
        {
            try
            {
                var images = Directory.GetFiles(sDir, "*.png");
                images.ToList().AsParallel().WithDegreeOfParallelism(100).ForAll(dd =>
               Rename(dd)
           );


            }
            catch { }

            try
            {
                foreach (string path in Directory.GetDirectories(sDir))
                        DirSearch(path);
            }
            catch (System.Exception excpt)
            {
                Console.WriteLine(excpt.Message);
            }

        }

Actually a question : whether it is optimized enough ? Need as quickly as possible to process all png files.

I have such problem : find all png files to disk and rename them as I did:

static void DirSearch(string sDir)
{
    try
    {
        var images = Directory.GetFiles(sDir, "*.png");
        images.ToList().AsParallel().WithDegreeOfParallelism(100).ForAll(dd =>
       Rename(dd)
   );


    }
    catch { }

    try
    {
        foreach (string path in Directory.GetDirectories(sDir))
                DirSearch(path);
    }
    catch (System.Exception excpt)
    {
        Console.WriteLine(excpt.Message);
    }

}

Actually a question : whether it is optimized enough ? Need as quickly as possible to process all png files.

edited title
Link
BCdotWEB
  • 11.3k
  • 2
  • 27
  • 45

finding Find and rename all png files c#

deleted 29 characters in body
Source Link
Heslacher
  • 50.4k
  • 5
  • 81
  • 175

Good day, I have such problem : find all png files to disk and rename them as I did:

static void DirSearch(string sDir)
        {
            try
            {
                var images = Directory.GetFiles(sDir, "*.png");
                images.ToList().AsParallel().WithDegreeOfParallelism(100).ForAll(dd =>
               Rename(dd)
           );


            }
            catch { }

            try
            {
                foreach (string path in Directory.GetDirectories(sDir))
                        DirSearch(path);
            }
            catch (System.Exception excpt)
            {
                Console.WriteLine(excpt.Message);
            }

        }

Actually a question : whether it is optimized enough ? Need as quickly as possible to process all png files thanks for the help.

Good day, I have such problem : find all png files to disk and rename them as I did:

static void DirSearch(string sDir)
        {
            try
            {
                var images = Directory.GetFiles(sDir, "*.png");
                images.ToList().AsParallel().WithDegreeOfParallelism(100).ForAll(dd =>
               Rename(dd)
           );


            }
            catch { }

            try
            {
                foreach (string path in Directory.GetDirectories(sDir))
                        DirSearch(path);
            }
            catch (System.Exception excpt)
            {
                Console.WriteLine(excpt.Message);
            }

        }

Actually a question : whether it is optimized enough ? Need as quickly as possible to process all png files thanks for the help

I have such problem : find all png files to disk and rename them as I did:

static void DirSearch(string sDir)
        {
            try
            {
                var images = Directory.GetFiles(sDir, "*.png");
                images.ToList().AsParallel().WithDegreeOfParallelism(100).ForAll(dd =>
               Rename(dd)
           );


            }
            catch { }

            try
            {
                foreach (string path in Directory.GetDirectories(sDir))
                        DirSearch(path);
            }
            catch (System.Exception excpt)
            {
                Console.WriteLine(excpt.Message);
            }

        }

Actually a question : whether it is optimized enough ? Need as quickly as possible to process all png files.

Source Link
Lolidze
  • 201
  • 1
  • 4
Loading