using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace Dropboxifier
{
static public class FileUtils
{
///
/// Given a directory select a random file from it.
///
static public string SelectRandomFileFromFolder(string folderName)
{
DirectoryInfo di = new DirectoryInfo(folderName);
if (di.Exists)
{
FileInfo[] files = di.GetFiles();
if (files.Length > 0)
{
Random randGenerator = new Random();
int index = randGenerator.Next(0, files.Length - 1);
return files[index].FullName;
}
}
return null;
}
}
}