Currently I have a recursive directory of files that looks like the following
foo_1/bar_1.txt
foo_1/foo_2/bar_2.txt
foo_1/foo_2/bar_2a.txt
foo_1/foo_2/foo_3/bar_3.txt
...
I need to use a bash script to convert them into single file names safe across all operations like the follows:
foo_1_bar_1.txt
foo_1_foo_2_bar_2.txt
foo_1_foo_2_bar_2a.txt
foo_1_foo_2_foo_3_bar_3.txt
...
However using the underscore as the replacement of "/" would undermine the backward process and one cannot convert them back to the original "Path" names.
I am currently considering using "=" as the replacement character and thing will look like
foo_1=bar_1.txt
foo_1=foo_2=bar_2.txt
foo_1=foo_2=bar_2a.txt
foo_1=foo_2=foo_3=bar_3.txt
I went through this question (Good style/practices for separators in file (or directory) names) where the answer suggests using multi-character options but I since my file names are already pretty long and need to be kept below a certain threshold after the "replacement process", if a single character option, that is human readable, is available things will work in my best interest.
I have tested touching a file with equal sign and it is working fine on at least MacOS, however I am afraid there are some other systems that will result in problems. Are there any caveats in doing this?
EDIT: The purpose of my process, is to convert a tree-like directory structure into a single directory, upload the files to a server (via ssh) that only accepts single directory structure, and then have another computer download (via HTTP) the files and convert them back to the directory structure.