I need to move a directory structure from an ext4 partition to a FAT partition. There are different rules for filenames for the two. For example, ext4 allows two files foo
and Foo
to be in the same directory and be unique. This is not true for FAT. I am looking to see if there is an algo already out there for converting names between the two. It is ok for the filename to be changed in my case, but I need to be able to read the new FAT name and be able to know what old ext4 name it corresponded with. So the algo has to be something that can be reversed. Does anyone know of such a thing?
Asked
Active
Viewed 85 times
1

corbin
- 1,446
- 2
- 27
- 40
-
To be reversible, it would have to transform all name, even fat-legal ones. – ctrl-alt-delor Dec 27 '18 at 00:14
-
If you imply a `8.3` FAT, this is technically impossible. – user58697 Dec 27 '18 at 01:19
-
Reversibility is impossible in the general case. Consider, for example, the ext4 name "foobar73.test.1". To make that a valid FAT name, you have to squeezed it down to 8.3 format. Let's say you just truncate it to "foobar73.tes". You have lost information that you can't get back. There is no algorithm that will let you compress an arbitrary-length file name into 8.3 format without losing information. – Jim Mischel Dec 27 '18 at 16:23
-
I originally thought of simple assign files to numeric names. So, `foo` would just become `0` if it was the first file in a directory and then I would have a 2nd file, like `0.name` that contained the associated name. I think this works, though it is a bit ugly. – corbin Dec 27 '18 at 19:49