Article Preview
Buy Now
COLUMN
File Renamer
A quick and dirty file renaming utility
Issue: 7.1 (November/December 2008)
Author: Brad Rhine
Author Bio: Brad Rhine is the developer of Kodiak, a complete student information system written entirely in REALbasic. That's his day job. In his spare time, he writes shareware applications in REALbasic.
Article Description: No description available.
Article Length (in bytes): 12,249
Starting Page Number: 50
Article Number: 7120
Related Link(s): None
Excerpt of article text...
Today we're going to write a small utility to help us make file name changes in bulk. I recently had some files -- a lot of files -- from whose names I needed to remove specific strings. I also needed to replace some strings with others. After doing it by hand for a few minutes, I thought, "I should write a REALbasic application to do this!" While writing the program, I thought, "This would make a great From Scratch project!" So here we are.
You might notice that source code is not included for this project, and that's simply because the project is very minimal. If you get stuck, feel free to send me an email, and I'd be happy to share my project file with you or help you out with the code.
Defining The Goal
There were a few specific things I needed my program to do. Given a folder, it should index all of the files contained therein (for my purposes, this didn't need to be recursive). Then for the name of each file, I needed to be able to replace certain string with other strings. Second, I needed to be able to remove certain strings from each file name. Lastly, I needed to be able to add a suffix or prefix to each file name, and the suffix needed to come before the file extension.
...End of Excerpt. Please purchase the magazine to read the full article.