How long are your file names?

Hey folks, we need your help.

We’re working on an updated filename encryption. To make it as efficient as possible we need to know how long your filenames are.

This script counts the total number of files in your home directory as well as the number of files with names that are longer than 80 and longer than 146 chars:

find ~ 2>/dev/null | sed 's:.*/::' | awk '{if(length > 146) {l146++} if (length > 80) {l80++} total++;} END { print " total: ", total, "\n longer than 80: ", l80, "\n longer than 146: ", l146}'

:warning: Try to understand what this script is doing! Do not just execute anything you find on the internet! :warning:


The output will look like this:

 total:  583391 
 longer than 80:  6885 
 longer than 146:  4

If you’re on macOS, Linux or have Cygwin installed, it would be of great help, if you could run the script and post the results in an answer to this topic.

Thank you! :heart:


See below for a windows script:

2 Likes
 total:  2311701
 longer than 80:  8813
 longer than 146:  3
2 Likes

old device:

total:  890355
longer than 80:  21090
longer than 146:  1

new device:

total:  384083 
longer than 80:  13952 
longer than 146: 0
2 Likes

total: 704249
longer than 80: 883
longer than 146: 20

2 Likes

total: 927089
longer than 80: 2363
longer than 146: 0

2 Likes

PC
total: 152348
longer than 80: 502
longer than 146: 0

Laptop
total: 18359
longer than 80: 12
longer than 146: 0

2 Likes

If you are on a windows machine and have powershell access and know how to deal with csv/excel, you can also use a script to create a list off your filenames and their length.

:warning: Try to understand what this script is doing! Do not just execute anything you find on the internet! :warning:
(I love this :wink: )

gci D:\PATH -recurse | select-object FullName, @{Name="Nlength";Expression={$_.Name.Length}} | sort-object FullName | export-Csv -path D:\listD.txt

Please replace D:\PATH with the folder you want to check (or your vault drive letter) and D:\listD.txt with the path and the name you want to have the results stored.
This is just a dirty script. It will show also folders containing no files at all and will then display the count of the folder. So you have to manipulate the output and exclude everything you don’t want to have here.
But its just a small step from there to come to the requested results.

Here we go, my results:

Files actually IN vaults

total: 33419
longer than 80: 74
longer than 146: 0

ALL files on system (excluding encrypted vault files)

total: 314036
longer than 80: 82953
longer than 146: 9
5 Likes
 total:  438535
 longer than 80:  6413
 longer than 146:  1
2 Likes

From ~:
total: 475153
longer than 80: 1778
longer than 146: 2

from the root of a second internal drive:
total: 139219
longer than 80: 3951
longer than 146: 3

2 Likes

total: 83442
longer than 80: 6248
longer than 146: 6

2 Likes

total: 2607056
longer than 80: 398128
longer than 146: 165

2 Likes

total: 126774
longer than 80: 248
longer than 146: 14

2 Likes

Vault Files (external Disk)
total: 121285
longer than 80: 108
longer than 146: 0

2 Likes

Home dir:
total: 450461
longer than 80: 889
longer than 146:

Vault files (file server)
total: 90111
longer than 80: 125
longer than 146: 1

2 Likes

total: 2836675
longer than 80: 28145
longer than 146: 235

2 Likes

One more result posted on Twitter by @thefuzzstone:

 total:  110849 
 longer than 80:  2365 
 longer than 146: 0
1 Like

total: 66663
longer than 80: 20
longer than 146:

2 Likes

Hi

My maximum file name is 199 characters long.

The microsoft windows limit is 240 characters for filename. Don’t go below !

1 Like

total: 44712
longer than 80: 160
longer than 146: 12

2 Likes

total: 462553
longer than 80: 7251
longer than 146:

2 Likes