3.5

3.5 | 2 ratings Rate this file 0 Downloads (last 30 days) File Size: 8.57 KB File ID: #16538
image thumbnail

crap: a pedestrian absolute folder/file path creator

by us

 

23 Sep 2007 (Updated 30 Jan 2008)

crap creates absolute paths to folders and/or files

| Watch this File

File Information
Description

CRAP creates clean absolute paths (including UNCs) for existing
- absolute paths to folders and/or files
- relative paths to folders and/or files
which may include any valid combination of './' and/or '../' syntax.

this shall help to overcome some of the notorious problems with ML’s handling of relative folder/file names.

see
>> help crap
and the accompanying published M-file for information and a few self-explanatory examples.

MATLAB release MATLAB 7 (R14)
Other requirements needs the java engine! tested under various windows flavors and current java (1.6.0)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (5)
16 Nov 2007 Dietrich Lueerssen

This is almost exactly what I need for a particular problem. It works fine, except in a case that I have quite often. If the file resides on a Windows file server (accessed through a UNC-type pathname such as \\Server\Folder\File.ext), then CRAP does not recognize the file's existence.

16 Nov 2007 Urs (us) Schwarz

a new version, which preserves the leading back-slashes in UNC paths, has been uploaded and should be available soon. thanks to dietrich for bringing up this problem.
us

26 Nov 2007 Dietrich Lueerssen

With the change Urs had introduced, the function now handles all the cases I normally deal with. From my point of view, the function is well programmed and documented. In addition, this is a neat example how java code can be incorporated into MATLAB (in case you are curious). Urs' response time to the suggestion was better than my new review, so I can only say: well done, keep up the good work!

Thank you.

10 Dec 2007 Karel Crombecq

When you try crap with only one directory, for example:
crap('thisdir')
It will crash, because it can't find any /. The following code works, but is identical:
crap('thisdir/')

Because I don't know which format the user will use to input the directory of choice, I can't use this utility until this problem is resolved.

Thanks for the good work,
Karel

10 Dec 2007 Urs (us) Schwarz

karel, we do NOT have this problem; can you get in touch with me by email?
thanks
us

Please login to add a comment or rating.
Updates
24 Sep 2007

a small change in the second output argument for consistency; version tag is 24-Sep-2007 01:18:28

19 Nov 2007

now handles UNC paths as well (thanks to dietrich lueerssen); version tag 17-Nov-2007 02:06:25

24 Jan 2008

a small annoying typo was removed; version tag is 24-Jan-2008 02:43:50

30 Jan 2008

removed erroneous java (1.6.0) behavior for root folders on winOS' when entered without the drive/volume name; added an option to suppress run-time messages; version tag 29-Jan-2008 19:41:46

Tag Activity for this File
Tag Applied By Date/Time
path us 22 Oct 2008 09:28:10
directories us 22 Oct 2008 09:28:10
files us 22 Oct 2008 09:28:10
file us 22 Oct 2008 09:28:10
folder us 22 Oct 2008 09:28:10
absolute us 22 Oct 2008 09:28:10
relative us 22 Oct 2008 09:28:10

Contact us at files@mathworks.com