Computer >> Computer tutorials >  >> Programming >> Python

How to get the maximum file name length limit using Python?


On some platforms, the maximum filename length varies according to the location on the disk. If you run UNIX with different filesystems mounted in various locations on your directory tree, you might see the following values for the maximum filename length in those locations:

>>> import statvfs, os
>>> os.statvfs('/')[statvfs.F_NAMEMAX]
4032
>>> os.statvfs('/boot')[statvfs.F_NAMEMAX]
255