Jiro's pick this week is a set of functions for operating on files and folders by Frederic Moisy.
I use MATLAB for analyzing data and creating tools for data analysis. But I like MATLAB so much that I use it for things other than regular work stuff. That's why when I came across Frederic's entry, it made me smile. This would certainly help me manage my files on my computer. With his collection of files, you can easily navigate to folders, manage folders, and view/manipulate file names.
To get the file names of my image files in "image1" and "image2",
'image1\im001.jpg' 'image1\im002.jpg' 'image1\im003.jpg' 'image1\im004.jpg' 'image1\im005.jpg' 'image1\im006.jpg' 'image2\im018.jpg' 'image2\im019.jpg' 'image2\im020.jpg' 'image2\im021.jpg' 'image2\im022.jpg'
To rename my image files by replacing certain text patterns,
cd image1 renamefile('*.jpg', 'im', 'newIm'); cd ../image2 renamefile('*.jpg', 'im', 'oldIm'); cd .. rdir('image*/*.jpg')
'image1\newIm001.jpg' 'image1\newIm002.jpg' 'image1\newIm003.jpg' 'image1\newIm004.jpg' 'image1\newIm005.jpg' 'image1\newIm006.jpg' 'image2\oldIm018.jpg' 'image2\oldIm019.jpg' 'image2\oldIm020.jpg' 'image2\oldIm021.jpg' 'image2\oldIm022.jpg'
One suggestion I have is for "renamefile" to work with multiple folders at once. But it's pretty useful as it is!
Let us know what you think here.
Get the MATLAB code
Published with MATLAB® 7.10