FileRealCase

版本 1.0.0.0 (3.1 KB) 作者: Jan
Get real upper/lower case of a file or folder name
298.0 次下载
更新时间 2011/2/13

查看许可证

Get correct case of file or folder by repeated calls of DIR

FileName = FileRealCase(FileName)
INPUT:
FileName: String, absolute path of an existing file or folder.
UNC paths are accepted.
OUTPUT:
FileName: String, absolute path with upper/lower case as set in the file system.

Matlab remembers the path as accessed in under Windows:
pathname = upper(fileparts(which('plot.m')));
% >> C:\PROGRAMME\MATLAB651\TOOLBOX\MATLAB\GRAPH2D
cd(pathname)
which('plot.m')
% >> C:\PROGRAMME\MATLAB651\TOOLBOX\MATLAB\GRAPH2D\plot.m
FileRealCase(which('plot.m'))
% >> C:\Programme\Matlab651\toolbox\matlab\graph2d\plot.m

I assume, this function is useful under Windows only, but it considers the Unix naming scheme also.

Matlab's WHICH can find the correct case of files inside the Matlab path also. But this fails for files in the current folder, if the folder was selected using a string with wrong case.

引用格式

Jan (2024). FileRealCase (https://www.mathworks.com/matlabcentral/fileexchange/30395-filerealcase), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2009a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 File Operations 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0