0

If my memory serves me correctly, in the early '90s on a Mac (but not on any MS O/S), one could print a hardcopy as an ordered list of a folders contents.

It occured to me that this is still a helpful thing for quickly printing out for condensed list where one hs many items such as docs, pics, music etc in a structured list. Does anyone know if this is possible on Ubuntu's Unity/frontend or if there is a small app in software centre. For now I cannot find one and for certain work would be a great 'time saver' instead of jotting down on paper with a pen. Any directions much appreciated.

Jorge Castro
  • 71,754
Paul B
  • 755
  • Print Screen key will screen capture, but can't you open 2 windows? From the command line I think it is "ls | lpr" but am sure someone can correct me if that's not right. –  May 19 '12 at 18:48

4 Answers4

2

One quick way to do what you are suggesting is to:

  1. Open up nautilus (the ordinary file browser)
  2. Navigate to the folder whose content file names you want to print
  3. Select everything (Ctrl-a) or Edit->Select all.
  4. Copy it to the clipboards with (Ctrl-c) or Edit->Copy
  5. Open Gedit (the default text editing software)
  6. Paste (Ctrl-v) or Edit->Paste
  7. Print the text with gedit's print function

The only downside to this is that it will be absolute paths, but you should be able to do some search and replace to get rid of the prefix.

As always, there is probably a command line way to do it much easier, something like piping ls into lp. If you need this solution as well and cannot figure out the commands, let me know and I'll look into it.

Regards TLE

TLE
  • 453
  • Thanks for your reply, it's interesting. Seems a little longwinded, but I'll bare it in mind. Really needed a quicker solution for my Drupal Webdev work or quick output of DIR content files, or family picture archive listings. Would be good to be able to print to A4 sheets even as an html list down across 2-columns. Maybe someone could develop an app or maybe Canonical could put it foward for a future Ubuntu release include. I sure people like me having moved over to digital archiving and 'information overload' now need someway to organise lists of volumes of files. – Paul B May 19 '12 at 18:21
  • It seems a little long winded, but in reality you can probably do it in 15 seconds or less with the shortcuts. To tell you the truth, I don't think there is much demand for it, since not very many people print in bulk, and second, if it is all about organizing large amounts of a certain kind of file, then there are other ways of doing that. For those reasons you can try to look for a program, but I don't think you'll have much luck. But as I also said, if you are not afraid of the command line it can probably be done even easier. – TLE May 19 '12 at 18:35
  • I agree, maybe I'll have to dig out my old lecturing notes on using CLI (-: I do also remember using a small program on winXP early '01ish which I would browse a directory, write a .txt file say from a CD and then print a page out and include it in the inner cover. That was handy as then I was an FE IT lecturer and then as now, a music producer guy and always looking for 'lost' files (not saying I don't organise (I have a degree in Organisational Management (Ha!)). Of course I can revert to the good old screengrab, but that was not per my original question. Anyway, thanks for replying TLE. – Paul B May 19 '12 at 18:46
  • No problem. Hope that you can achieve what you want. – TLE May 19 '12 at 19:03
1

A simple way to print a directory content list would be using command line tools:

ls | lpr <Printer>

This will pipe the output of ls (or any other command that generates an output) to the line printer , if installed. To find the name of attached printers run

lpstat -p -d

For a long list that may need formatting however I recommend to redirect the output of ls to a file.

For a right click solution we simply put a script to ~/.gnome2/nautilus-scripts/ with e.g. the following content (to open the current directory file list in Gedit):

#!/bin/bash

ls | gedit

Or we define a nautilus action to do so.

Takkat
  • 142,284
  • CLI, fine. But I had hoped something a little more in the flavour of Unity. Maybe a small project for someone, could be enhanced for CD/DVD archive purposes. Ideally, I'd have liked to see a 'right-button' function. I know it may seem petty in such a request, but maybe helps us differentiate Ubuntu from M$. "Every Little Helps". – Paul B May 19 '12 at 19:29
  • Bad idea to parse ls if filename contains special chars like new line . . . – Sergiy Kolodyazhnyy Oct 23 '15 at 22:27
0

I would recommend the tree command. It is recursive and you can redirect the output to a text file, then print the text file.

0

Use find command.

find . -maxdepth 1 -print | sort | lpr 

GUI approach would be with a simple script that is linked to a keyboard shortcut, say Ctrl + Alt + K. Call the script with shortcut, copy path to folder from nautilus with Ctrl + L and then Ctrl + C or X, paste in popup dialog

#!/bin/bash

PATH=$(zenity --entry --text="Enter path to directory") 

find "$PATH" -maxdepth 1 -print | sort | lpr 
Sergiy Kolodyazhnyy
  • 105,154
  • 20
  • 279
  • 497