“It seems every other week,” Samuel writes, “there’s a story about outsourcing gone bad. Maybe we’ve been lucky, but for the past decade or so, we simply couldn’t have survived without our friendly team of offsite developers.”

“You see, I work for a manufacturing company, and our main campus is located a good half-hour away from the outskirts of a suburb of a sparsely populated Midwestern city. Every business in town – from the dry cleaners to the restaurants – is owned or subsidized by the company. Just about every resident works, worked, or will work for the company. ”

Samuel continues, “now as charming as it all is, it’s all but impossible to recruit local software developers, and convincing ‘city folk’ to relocate is never easy. In ten years, I was apparently the only one crazy enough to move back after discovering all the wonderful things that suburban- or urban-living offered. Hence, all the outsourcing.”

“Unfortunately,” he added, “outsourcing had gotten a bad rap lately, and the powers that be decided to bring everything in house. The job of hiring a development team was left to me. As ‘interesting’ as the hiring process was, I thought I’d be best to share a tidbit from the now day-to-day life.”

The task was relatively simple, but since it involved some file operations (downloading, processing, and then deleting files from a vendor), I assigned it to my strongest developer. This is what he came up with for the deleting files part.”

DirectoryInfo dir = new DirectoryInfo(pathToDelete);

// subDirs
DirectoryInfo[] subDirs = dir.GetDirectories();
foreach(DirectoryInfo subDir in subDirs)
{
  // subSubDirs
  DirectoryInfo[] subSubDirs = subDir.GetDirectories();
  foreach(DirectoryInfo subSubDir in subSubDirs)
  {
    // subSubSubDirs
    DirectoryInfo[] subSubSubDirs = subSubDir.GetDirectories();
    foreach(DirectoryInfo subSubSubDir in subSubSubDirs)
    {
      // subSubSubSubDirs
      DirectoryInfo[] subSubSubSubDirs = subSubSubDir.GetDirectories();
      foreach(DirectoryInfo subSubSubSubDir in subSubSubSubDirs)
      {
        // ********************************************
        // should be enough; if not, I can add more here
        // ********************************************
      }

      // files
      FileInfo[] subSubSubFiles = subSubSubDir.GetFiles();
      foreach(FileInfo subSubSubFile in subSubSubFiles)
      {
        subSubSubFile.Delete();
      }

    }

    // files
    FileInfo[] subSubFiles = subSubDir.GetFiles();
    foreach(FileInfo subSubFile in subSubFiles)
    {
      subSubFile.Delete();
    }
  }

  // files
  FileInfo[] subFiles = subDir.GetFiles();
  foreach(FileInfo subFile in subFiles)
  {
    subFile.Delete();
  }
}

// files
FileInfo[] files = dir.GetFiles();
foreach(FileInfo file in files)
{
  file.Delete();
}

“I wish I could say the rest was any better, or that this wasn’t produced by my best coder. But hey, at least I can say it wasn’t outsourced!”

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!