Yifan Wang
Yifan Wang

Reputation: 534

linux file name(full path) encode

I want to encode linux file name(full path), is there some method? examle: input: (the dir structure like this: )

/root/
/root/fileA.txt
/root/dir/
/root/dir/fileB.txt

after encoding: (just like this, human-readable is not necessary)

%root%
%root%fileA.txt
%root%dir%
%root%dir%fileB.txt

and using those new name as the new file name that I can put those files into one dir. after like this:

/root1/%root%
/root1/%root%fileA.txt
/root1/%root%dir%
/root1/%root%dir%fileB.txt

Upvotes: 0

Views: 534

Answers (1)

Yifan Wang
Yifan Wang

Reputation: 534

It's a trick way. I used mktemp function to generate the new filename.

Upvotes: 1

Related Questions