File Exchange

image thumbnail

fileparts2(file)

version 1.0.0.0 (807 Bytes) by Erik Roberts
fileparts without missing trailing slash bug

0 Downloads

Updated 20 Mar 2017

View License

% Purpose: Fixes mixing trailing slash bug in fileparts. If path is a dir without
% a trailing slash, will add the slash so fileparts gives expected pathstr.
%
% Usage: [pathstr, name, ext] = fileparts2(file)
%
% Explanation:
% Given a directory structure: ./parent/child/
%
% Problem:
% fileparts(parent/child/) = parent/child % Expected
% fileparts(parent/child) = parent % Bug
%
% Solution:
% fileparts2(parent/child/) = parent/child % Expected
% fileparts2(parent/child) = parent/child % Fixed bug
%
% See also FILEPARTS

Comments and Ratings (0)

MATLAB Release Compatibility
Created with R2017a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags