Re: How to change file names?
- To: mathgroup at smc.vnet.net
- Subject: [mg70841] Re: How to change file names?
- From: "David Reiss" <dbreiss at gmail.com>
- Date: Sat, 28 Oct 2006 23:38:54 -0400 (EDT)
- References: <ehv9b5$gav$1@smc.vnet.net>
Simply use RenameFile: In[1]:=?RenameFile "RenameFile[\"file1\", \"file2\"] renames file1 to file2 --David http://scientificarts.com/worklife In[1]:= ?RenameFile \!\(\* RowBox[{"\<\"RenameFile[\\\"file1\\\", \\\"file2\\\"] renames file1 to \ file2.\"\>", " ", ButtonBox[ StyleBox["More\[Ellipsis]", "SR"], ButtonData:>"RenameFile", Active->True, ButtonStyle->"RefGuideLink"]}]\) solidifire 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.