简体   繁体   中英

Encoding file names in a file system storage

I am creating a simple file system storage in which I name my files using several special characters (eg: /, :, ;, *, ?), so subsequently these file names will be converted into unidentifiable expressions once I store my data within the file system.

When I now try to make use of my files within my code my stored data gets "useless" as I am not able to identify it with my intended file names anymore.

Are there some ways or methods to be recommended which I can use to encode my file names before using them as such and decode them back to their original expressions once I need to use them in my code again?

Especially with regard to the deletion of files from my system it would quite helpful to possess the same expressions for my actual file names and the received file names from my storage.

Thanks in advance!

I would use a base64url encoding. The encoding should be supported by librarys in every major language and you can use shell tools too, if you ever want to access the files manually.

But if you have a limited charcter set, you can simply replace the characters by safe ones.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM