Special

Special Print Closeout!

We're clearing out the remainder of our print issues at fire sale prices -- as much as 75% off! Quantities are extremely limited and only available while supplies last. Hurry to take advantage of this one-time offer.

RBD Magazines

Once these printed back issues are gone, they are gone!

Article Preview


Buy Now

PDF:

From Scratch

File Renamer

A quick and dirty file renaming utility

Issue: 7.1 (November/December 2008)
Author: Brad Rhine
Article Description: No description available.
Article Length (in bytes): 10,729
Starting Page Number: 50
RBD Number: 7120
Resource File(s): None
Related Link(s): None
Known Limitations: 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.

Article copyrighted by REALbasic Developer magazine. All rights reserved.


 


|

 


Weblog Commenting and Trackback by HaloScan.com