views:

71

answers:

3

I have a very complex web app project I want to re-structure. Naturally, it consists of a considerable number of folders and sub-folders. I have a huge piece of paper ready to sketch a new structure on.

Now, I need paper printouts of the projects. Some directories I need in full detail including their files - the /library directory for example that contains core parts of the engine. Other directories, I need in much less detail, with just the sub-directories, or not even that.

I am on Windows and can use the tree command but that only gives me a full listing of the whole structure I then have to clean up by hand. I would much rather have a tool which I tell which directories I need in which depth, and in which I can save those settings.

Does anybody happen to know such a tool?

Edit: I have kind of sorted it out using the tree command, deleting the entries manually. To get what I wanted I would probably have to write a script of my own, which I can't do right now. Any hints are still welcome.

+1  A: 

Are you wanting a batch file/folder renamer? Or something that lets you export the tree to a CSV or XML, or do you want to just see the files you want in the tree?

I used to use a program called FileMonkey, but it hasn't been updated since 2005. A quick search for the latest and greatest batch file handler turned up a few, the one I liked is Flex Renamer.

Anthony
Cheers Anthony, but I'm not looking for a renamer, I need to print out the tree on A4 paper. I don't care about the format as long as I can influence the complexity on a per-folder basis (that is the difficult part) and get it printed.
Pekka
So you want both the ability to print the tree and to specify what parts of the tree to print, right?
Anthony
@Anthony yup, and to make things even more difficult, for some directories I want all folders + files, and for some just the directories, and some I don't want at all. I think I am going to do this manually, I fear I would have to write it myself otherwise :)
Pekka
In Windows, you can go to command prompt, go to the directory, and then do `dir /s > allfiles.txt`. This isn't quite the custom list you want, but if you are going to do it by hand, this would be a huge time-saving first step. You could then either bring it into a robust text editor and wrap everything into XML or comma separate it all out, or open the txt file directly in Excel and then trim down from there, maybe using filter options and the like.
Anthony
Oh, and a quick check confirms the same output to file trick will work in Linux/Mac from terminal.
Anthony
+1  A: 

I would use a bit of Powershell code for this Take a look at this example and look at the help page for getChilItems (gci). You can specify files to include and files not to include.

$DllFiles = gci "C:\Windows\System32" -recurse | ? {$_.extension -eq ".exe"} Foreach ($Dll in $DllFiles) { $Dll.name + "t " + $DLL.CreationTime + "t " + $Dll.Length $i++ } Write-Host The total number of files is: $i

Here is an example of the exclude parameter Get-ChildItem c:\scripts*.* -exclude .txt,.log there is also an include parameter is that fits your needs better.

Development 4.0
Cheers, this looks good. I can't try it out right now but I'm going to accept this answer and add Feedback later.
Pekka
+1  A: 

Apoligies if you've already tried this - I have no idea of your level of Linux knowledge.

Sounds like you may want to use find. It can find everything under a certain path with

find /path/to/directory/

or it can find just directories with

find /path/to/directory/ -type d

Using either approach, you can redirect the output to a file

find /path/to/directory/ -type d >> output.txt

find /path/to/somewhere/else/ >> output.txt

and then edit the file as you see fit.

Hope that is helpful.

-Jim

Jim N