PrintTree — User Command

Please read this entire post before proceeding!

SYSTEM REQUIREMENTS:
Requires the Tree.com command to be in the system path. Tree.com is included in Windows XP/Vista.

NOTE: This user command has only been tested in Windows XP. But it should work right away in Windows Vista, and possibly Windows 2000. I'm not sure of this, but I believe that Tree.com also exists in Windows NT/2000 and Windows 95/98/ME. However, I know the PrintTree script will require some rework before it will work in Windows 95/98/ME and may also require rework for Windows NT/2000. If you have one of these operating systems, try out the button (it won't hurt anything), and post back with your results.

USER COMMAND:

PrintTree - User Command

This command creates a printable ASCII text file report that contains a Folder Tree with the current (source) lister path as its root. The Tree displays all subfolders below the current (source) lister path. The report also contains a date and time stamp, provided by Opus.

The PrintTree user command is a command script that uses the Windows command Tree.com to write a temporary report file to the %Temp% folder. The PrintTree command script then displays this report in Notepad. The PrintTree command script also deletes the temporary report file from the %Temp% folder, once Notepad is closed. To retain the report, save it to another location from within Notepad.

When PrintTree is used from the Windows Desktop, Opus will pass the Desktop folder, not the actual Desktop namespace to the command, which results in a tree listing of the desktop folder. PrintTree cannot be used from within a File Collection or the File Collections List.

IMPORTANT: Using this PrintTree command from within other Windows Namespace folders, like My Computer, will result in errors and is not advised!

The command template is:

FILES/S PATH/K

  • FILES/S - When this switch is used, the displayed tree will also list all files inside of each folder along the folder tree.

  • PATH/K - Use this option to specify a folder path for the PrintTree operation, instead of using the current folder. This option can be used to pass a discrete path, or to have Opus pass the paths for several selected subfolders.

Example 1:

(All Usage Examples are included in the .zip download file.)

Display a tree report in Notepad of the folder path listed in the Source Lister without files:

PrintTree

The output of this command is:

Date: 2006-12-06 22:18:56
    
Folder PATH listing for volume Temp_Files
Volume serial number is 3234-F800
T:\TESTING\OPUS\V8.X\TEST FOLDER
+---Folder A
|   \---Subfolder A
+---Folder B
|   \---Subfolder B
\---Folder C
    \---Subfolder C

Example 2:

Display a tree report in Notepad of the folder path listed in the Source Lister with files:

PrintTree FILES

The output of this command is:

Date: 2006-12-06 22:12:39

Folder PATH listing for volume Temp_Files
Volume serial number is 3234-F800
T:\TESTING\OPUS\V8.X\TEST FOLDER
|   Root File 1.txt
|   Root File 2.txt
|   Root File 3.txt
|   
+---Folder A
|   |   File A.txt
|   |   
|   \---Subfolder A
|           Subfile A.txt
|           
+---Folder B
|   |   File B.txt
|   |   
|   \---Subfolder B
|           Subfile B.txt
|           
\---Folder C
    |   File C.txt
    |   
    \---Subfolder C
            Subfile C.txt

Example 3:

Display a tree report in Notepad of a named folder path:

PrintTree FILES PATH="%ALLUSERSPROFILE%"

Example 4:

Display a tree report for each selected subfolder in the Source Lister:

dopusrt /CMD PrintTree FILES PATH="{filepath$}"

TIP: To make PrintTree available from the context menu each time you right-click on a folder, add the command above to:

Settings Menu - File Types - Directory Opus File Types - [All Folders] - Context Menu

Make sure the Action Type is set to: Run an Opus Function (not supported in Explorer).

RELEASE NOTES:

Version 1.5:

  • Added PATH/K which allows a discrete folder path to be specified, instead of using the currently listed Source path.
  • Modified the User Command script to allow toolbar buttons to utilize dopusrt /CMD syntax which allows the user to create buttons that operate on all selected subfolders.
  • NOTE: Sample buttons that make use of each change are included in the .zip download file.

Version 1.0: Original download file (unversioned).

HOW TO CORRECTLY GET THE COMMAND TO YOUR DIRECTORY OPUS CONFIGURATION:

  • Download the attached PrintTree.zip file and extract it to a folder.
  • Open the PrintTree folder in an Opus lister.
  • Right-click any Opus toolbar and select Customize.
  • Click on the Customize > Commands Tab.[
  • Click on the User Category.
  • Drag PrintTree-UserCommand.dcf to the User Commands list.
  • Drag these buttons to any toolbar.
    • PrintTree-Files.dcf - Displays a printable folder tree report (with files) of the current folder in Notepad.
    • PrintTree-NoFiles.dcf - Displays a printable folder tree report (without files) of the current folder in Notepad.
    • PrintTree-2-Button.dcf:
      • LMB: Displays a printable folder tree report (with files) of the current folder in Notepad.
      • RMB: Displays a printable folder tree report (without files) of the current folder in Notepad.
    • PrintTree-ALLUSERS.dcf: Displays a printable folder tree report (with files) of the the All Users Profile folder in Notepad.
    • PrintTree-Selected.dcf: Displays a printable folder tree report (with files) for each selected subfolder in Notepad.

Remember PrintTree is a User Command not a Toolbar Button!

The PrintTree command code is structured differently from most other toolbar buttons. User Commands differ greatly from Toolbar buttons. For instance, once a User Command is created, it can be used from inside other Toolbar Buttons. If its template is configured correctly, any qualified options for a user command will be displayed in its Arguments List in the Advanced Command Editor.

When Directory Opus User Commands are exported to a Directory Opus Command (*.dcf) files, they appear very much like exported Toolbar Buttons. User Commands, that do not utilize a Command Template, can be exported to a *.dcf file and subsequently dragged directly to a Directory Opus toolbar to create a Toolbar Button without actually creating the related User Command.

IMPORTANT: User Commands that do utilize a Command Template (like PrintTree) cannot be directly dragged to a toolbar--doing so will create a Toolbar Button with no Command Template, breaking the intended functionality of the user command.

I hope you find this useful :smiley: and educational :bulb:

PrintTree-v1.5.zip (4.82 KB)

This command has been updated. Read the Release Notes in the first post for changes and download the new version.