in reply to best way to encrypt long file names?

It is worse. crypt() encrypts only the first 8 characters, so that any (file)names with the same 8 starting chars encrypt to the same string (given the same seed). Also you don't get 13 chars out of it, but 11, because the first to characters are the preselected seed. You could use 2 characters of your filename as seed, but then you would give an attacker already two known characters of the filename for free

You might look at other hash algorithms, for example Digest::MD5 or Digest::SHA2. Base64 encoded you still get '/' in the hash, but you could afterwards use tr{/}{-} to change every / into a -

You do know that hash functions are one-way, right? You can't decrypt those filenames later on, not with crypt nor any of the hashes I mentioned. If you need to decrypt them again you have to use a symmetric chiffre like DES or AES

If you need a better answer, tell us more