10 March 2014

Unusual uses for ExpPrint–Finding long file paths

A customer recently told me they were using ExpPrint to find occurrences of files with very long path names. Their backup program had a problem with file paths that exceeded the normal 260 character limit, so they needed to find them and shorten them.

Essentially, the method requires getting a list of all the files with their full path name into an application where you can either visually identify the length, or get the application to display the length. I’ll show how to do the latter using Microsoft Excel.

First, use ExpPrint to get the list of files with their full path name…

In Windows Explorer, right click on the root folder or drive you’re interested in and invoke ExpPrint. Create the listing in the normal way.

In the ExpPrint Viewer, choose the Detailed Table (HTML) or Detailed Table (Text/CSV) option. The CSV option is the best choice if you’ll be using a spreadsheet to process the results.

In the Detailed Tables Options dialog, use these settings:

  • Only check the Name column – leave all the others unchecked.
  • Sort by: Path. This isn’t essential, it just means the basic listing you get is initially sorted alphabetically.
  • Check all options except for “Files” and “Items with the Hidden file attribute”.
  • Uncheck both Folders and Files.
  • Check the “Show Full Path Name for – Files option.

Save the settings so you can quickly restore the options if you need to do the operation again.

Press Next to produce the listing and invoke the viewing application (your web browser for HTML, or your spreadsheet application for CSV). This produces a listing containing a single column of the files complete path name.

Processing the Listing

If you’ve created an HTML listing, you can select the text in the browser and copy & paste it into another application such as a plain text editor. If your text editor has some way of easily identifying lines that exceed a certain length, you can use that to identify long paths.

If you create a CSV listing and use a spreadsheet program such as Microsoft Excel, you’ll have more powerful capabilities. It’s easy to create a formula to show the length of the path, and sort and format the result to see entries that exceed the 260 character limit.

If you’re using Excel, in the second column (cell B1), enter the formula: =LEN(A1)

This will display the number of characters in the string in cell A1.

With cell B1 still selected, press Ctrl+Shift+End to extend the selection to the last row.

Now, use Excel’s Fill Down command (Ctrl+D) to duplicate that formula for every row in the spreadsheet.

Column B will now be showing you the length of the file paths (from column A).

You can now use Excel’s sorting facility (Data, Sort) to sort by Column B values. If you choose the “Largest to Smallest” sort option, the long file paths will be at the top of your spreadsheet.

If you want to get a bit fancier, you can use Excel’s Conditional Formatting facility (Highlight Cell Rules, Greater than) to colour the cells that have a value greater than 260 characters long.

Here’s an example of the result in Excel:


Any files with paths that exceed 260 characters are clearly shown.

While you can use the dir command (dir /B /S) to create the file listing, ExpPrint does it better, by handling Unicode file names and recursive symbolic links.

If you’ve used ExpPrint to do something specific to help you in your business, please let us know, you’re unlikely to be alone in needing to do what you’ve done, so someone else may benefit from your knowledge. Your experience will also give us more insight into how best to improve our software, so please let us know how you’re using it.

No comments:

Post a Comment