I was using a program called wget to create a backup, on my hard drive, of the contents of my blogs. I wanted to see how deep this backup went. That is, I could see that wget was creating subfolders, and sub-subfolders, and sub-sub-folders, two and three and more layers deep. There were thousands of folders. I couldn’t open them all manually, to see how deep the deepest one went. This post describes how I found the answer.

I started with a command on the Windows (sometimes called DOS) command line. This was the command I used:

dir /ad /b /s > D:\dirlist.txt

Then I opened dirlist.txt to see what the command had given me. Here is the kind of output I saw there:

D:\blogname.wordpress.com\2014
D:\blogname.wordpress.com\2011\09
D:\blogname.wordpress.com\2011\09\19
D:\blogname.wordpress.com\2011\09\19\postname
D:\blogname.wordpress.com\2011\09\19\postname\amp

In that example, the deepest folder (“amp”) was sixÂ levels below the top (D:) level. But, again, I had thousands of folders. So I pasted the contents of dirlist.txt into an Excel spreadsheet, starting with cell A1. Then I wrote a formula to count the number of levels. Here is the Excel formula I used:

=LEN(A1)-LEN(SUBSTITUTE(A1,"\",""))

I copied that formula all the way down, to count the number of levels for every subfolder. Finally, at the bottom, I used Excel’s MAX function to find the deepest level.

### Like this:

Like Loading...