Get relative path from absolute path
Archived 3 years ago
Q
QWERTZ
Playing Custom Status
Verified
So I made an application which compresses files (NOT ZIP). But this isnt the problem right now. Now I am at the point: decoding and encoding works fine but if I wanted to encode a folder, lets say my folder structure is like this:
ALL FILES:
```nt
C:\users\qwertz\test\main.py # the python file
C:\users\qwertz\test\directory\ # the directory which gets compressed
C:\users\qwertz\test\direcotry\subfolder\ # some subfolders
C:\users\qwertz\test\direcotry\subfolder\hello.txt # some subfiles
```
We don't know how much subfolders / files are in there. If I did ``dir /s /b /o:gn`` and saved the output to a file, then I would get smth like this:
```txt
C:\users\qwertz\test\directory\subfolder\hello.txt
```
It correctly gives me all files. But those paths are absolute (for example ``C:\users\qwertz\test\directory\subfolder\hello.txt`` should be relative to directory: ``\subfolder\hello.txt``.
How can I achieve this? Thanks for help!
