How to rename a bunch of files with numbers?
From my earlier post-Day-today Programming 1 I told you how my mom asked me to write her a DVD.
Then as I mentioned earlier, I managed to take a printout of the filenames. Now I have to write them into a DVD. But mom asked me to rename the MP3s with numbers. so that she can find the number of the MP3 printed-out document. So I again wrote a simple java program to rename the files with numbers starting from 1.
Here is the small program I wrote.
See, how small and how easy :)
From my earlier post-Day-today Programming 1 I told you how my mom asked me to write her a DVD.
Then as I mentioned earlier, I managed to take a printout of the filenames. Now I have to write them into a DVD. But mom asked me to rename the MP3s with numbers. so that she can find the number of the MP3 printed-out document. So I again wrote a simple java program to rename the files with numbers starting from 1.
Here is the small program I wrote.
//simple java program to rename files with numbers.
import java.io.File;
import java.io.IOException;
public class Rename2Numbers {
public static void main(String[] args) throws IOException {
File folder = new File("C:/My Folder");
int i = 1;
for(File f : folder.listFiles()){
f.renameTo(new File("C:/My Folder/"+i+".mp3"));
i++;
}
}
}
See, how small and how easy :)
Comments
Post a Comment