Problem 2625. Shorten pathname

Created by Matthew Eicholtz in Community

Given a pathname string, return a condensed version by replacing intermediate folders with '..'.



fullpath = 'C:\foo\bar\baz\qux';


shortpath = 'C:\..\qux';

Solution Stats

58.43% Correct | 41.57% Incorrect
Last solution submitted on Jan 22, 2019

Problem Comments

Recent Solvers41

Suggested Problems

More from this Author46

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!