File name search & replace question
File name search & replace question
- Subject: File name search & replace question
- From: "Rips Ethan J" <email@hidden>
- Date: Wed, 23 Oct 2002 12:56:39 -0400
- Thread-topic: File name search & replace question
I. Background:
I need to write a script that accesses a bunch of files in a folder whose
names are something like this: {"385SOI1.txt", "385SOI2.txt", "385SOA.txt",
"385SOCR.txt", "385SOAL.txt", "385SOO.txt", "385SOC1.txt", "385SOC2.txt",
"385CFIA.txt", "385CFIB.txt", "385CFIC.txt", "385CFIR.txt", "385CFIT.txt"}.
(In reality, some of these have the code appearing after the alpha part of the
names; some also have spaces between the alpha & the numerical portion of the
file name.)
Adding to the fun, each document to which such a list of files corresponds
does not necessarily include the same combination of files. Some have the SOA
& SOCR files, for example, while others do not.
I need to figure out how to do a search of the file names, appending a
numerical prefix ("01", "02", etc.) to each based on the alpha portion of each
filename (the existing alpha & numerical indexes-file1, file2, etc-will take
care of themselves in terms of the order in which the renamed files appear in
a list-I assume, at least), and the presence or absence of some of the other
files (as noted in the paragraph above).
The result should be a list of files ordered by type as well as quantity per
type (i.e., SOI files in order followed by SOA & SOCR, then SOAL, or followed
directly by SOAL, etc.).
Once I've got that I can access each file in order for insertion in a BBEdit
document for massaging by an existing script.
II. The question (bet you thought I'd never get around to it):
Has anyone got any ideas on the most efficient way to do the search & replace
functions in the filenames prior to accessing the contents of each file for
insertion into a BBEdit file? Are there better ways of going about this?
Thanks.
Ethan
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.