[Date Index] [Thread Index] [Author Index]
Re: How to change file names?
Aside from the weird 1/10th file size problem, it wouldn't be a good idea to read a JPEG and then write it out if one wanted to retain all the information in the picture, since a JPEG save is lossy. So, why not use RenameFile? You could also use StringExpression to help you rename the files. On 10/28/06, solidifire <barabbasgospel at yahoo.com.tw> wrote: > There are n JPEG files, with file names f1, f2, ..., fn. > I want to change their names to, for example, g1, g2, ..., gn. > Of course the easiest way is to change file names by myself, > but this is not convenient when n is large. > How should I do by using Mathematica? > I tried: > > Export["g1.jpg", > Import["f1.jpg", "JPEG"], "JPEG"] > > It does change the file name as I expect. > There is, however, a side effect: > somehow the file size in bytes of g1.jpg is one-tenth of that of > f1.jpg. > Besides, I have to read in the files and then write out the files > -- I don't think these two steps are really necessary, > because all I want to do is to change the file names. > Is there any better method? > Thank you in advance. > > -- http://chris.chiasson.name/