Blogs

RedMonk

Skip to content

Copying Windows Directory Information Into a Spreadsheet?

Enjoying Mashup Camp a great deal and will have more on it soon, but just got a semi-urgent technical question from a friend that I don’t have an immediate answer to. It seems absurdly simple, but for some reason I can think of how to do it.

The problem is this: said friend needs to take the contents of several Windows network directories (don’t ask why – I’ve already been down that route) – with extended file attributes included, like “Owner” – and get it from the directory into an Excel spreadsheet. In short, all they need to do is cut and paste a bunch of file names along with the file owner into a spreadsheet. Not particularly difficult, one would think.

Normally, I’d just get into the directory on the command line and do a “dir,” and cut and paste from a terminal window – but the directory is a network share and only accessible over a VPN, and this apparently prevents such access. Or at least I don’t know how to do that on Windows. At this point, the only way to cut and paste the file names is by accessing the network share on Firefox (IE turns into Windows Explorer, rather than a standard browser window) – but there’s no way to get the owner information in that fashion.

There’s got to be an easy way to do this: any quick, easy thoughts? I’m sure I’m not thinking of something, so any and all help appreciated.

Categories: Completely Off Topic.

  • http://www.fluxhq.com Rohit Sankaran

    This /might/ be possible, if you have +wx on the directory. Make a batch file with the code listing below and execute it?

    dir [whatever switches] :gn >filelisting.txt

    Then you can view filelisting.txt on Firefox.

    Then again I might be way off base.

  • http://fraxas.blogspot.com Fraxas

    Search the extended MSDN documentation on the Shell scripting object. I’m sure there’s a way to iterate over files with it — you can even use JScript rather than VBasic if you want. The last time I ran into Windows scripting was coming up with a shell script tha would open the Run dialog — something I need to do because Toshiba hates me, and put the Windows key in the top right of the keyboard and put the Fn key where Win should be. Luckily it came with a utility for binding Fn+arbitrarykeystroke to an executable.

    here’s some VB that creates a shell object you can operate on to get at files and things, and use as a hook for grovelling around MSDN:

    Dim objShell
    Set objShell = CreateObject(“Shell.Application”)

  • http://www.redmonk.com/sogrady stephen o’grady

    thanks guys – i’ll try these, after i try one of a couple of directory printer applications that seem to be able to read and dump the drive contents. they probably, now that i think about it, leverage the exact things you’re discussing.

  • http://www.michaeldolan.com Mike Dolan

    Why not access the shared drive from a Linux box and write a shell script to list/parse what you need? Like parse an “ls -l” output and dump it into a CSV text file. Open it in OO or Excel.

  • http://www.redmonk.com/sogrady stephen o’grady

    mike: that would have been a great idea, but fortunately wasn’t necessary. we got the data we needed using the trial of the app here:

    http://www.novell.com/coolsolutions/tools/14782.html

    didn’t work particularly fast, but it got the job done.

    thanks to everyone who wrote in with suggestions.