Enumerate folders and files

Hi,

I want to make an excel file that I show it to folder, and then it find all the files (in subfolders too) in the folder, and then it will write them on a sheet, make a file list on the sheet. But I couldn’t make the file.

Can you help me ?

Thanks for your helps.

Hi, thanks for your consideration.

You can use Aspose.Excel to do it. Following is a simple sampe. You can extend it to meet your need.

using System;
using System.IO;
using Aspose.Excel;
namespace FileEnum
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
Excel excel = new Excel();

string[] dirs = Directory.GetDirectories(args[0]);

string[] files = Directory.GetFiles(args[0]);

excel.Worksheets[0].Cells.ImportArray(dirs, 0, 0, true);
excel.Worksheets[0].Cells.ImportArray(files, 0, 1, true);

excel.Save(“d:\files.xls”, FileFormatType.Default);
}
}
}