Generating Excel file based on folder contents

Is it possible to create a excel spreadsheet based on a folder tree, including its subdirectories and filenames? Is their a way to do it with excel itself or is there a program out there that makes this possible?


If you need to do this just once and not update it, then something like this should work:

 cd directory
 tree > tree.txt

Now do following:

  1. Open tree.txt in a text editor which can do regular expressions, such as Notepad++. The regular expressions below are for Notepad++, so you may have to tweak them a bit for another editor with different regexp dialect. Notice how each directory tree level is 4 prefixing characters.

  2. Remove any lines you don't care about.

  3. Replace, with regular expression and wrap-around checkboxes checked:

    • Find: ^(\t*)[^\tA-Za-z0-9_]{4}
    • Replace: \1\t
  4. Keep repeating above step until 0 occurences are replaced. Look at how file changes.

  5. Copy the text (ctrl-a ctrl-c) and paste to Excel. Tab characters should put directory hierarchy neatly to Excel columns

Some notes about the regexp:

  • \t is Tab character, both in expression and replacement
  • \1 in replacement means whatever whas matched by first () in the expression
  • Initial ^ in expression matches start of line
  • [^...] in expression means, match any character not listed
  • {4} in expression means, match exactly 4 occurences of whatever was before (the [^...] in this case).

So in short, this matches and ()-captures any tabs at start of line, then matches also next 4 non-tab/letter/number/underscore chars. Then this is replaced first by any tabs that were captured, then one extra tab. So each time this regexp is done, one more sequence of 4 non-directory-name chars get replaced with tab.

Need Your Help

mysql query returns values outside of WHERE range when using BETWEEN or >= & <=

mysql where

I'm stumped. I have a date field in a MySQL database that I fill from a csv file. The date field is in a format of mdy, so it can have leading zeros (which I thought was the problem). So Aug 9, ...

Android auto installation of APKs

android webview apk

I have a webview which basically is capable of intercepting all sorts of links, video, apks, hrefs.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.