realpath

Resolves relative paths and extra filesep characters in the input.
353 Downloads
Updated 12 Jan 2010

View License

Updated version of realpath by M MA using suggestions made on that file submission and additional testing. Works for Windows, may need some tweaks for Unix. Substantially faster than original version in testing.

Resolves relative paths and extra filesep characters in the input.

Syntax:
OUTPUT = REALPATH(THEPATH)

where THEPATH is the path to a file or folder, which should exist.

Example:
realpath('../myfile.txt');
% returns /home/user/whatever/myfile.txt

Cite As

Anthony Corr (2024). realpath (https://www.mathworks.com/matlabcentral/fileexchange/26360-realpath), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2009b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Search Path in Help Center and MATLAB Answers
Acknowledgements

Inspired by: realpath

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0