OK
Rating:
0.00
Thread Listing » Electronics, Gadgets, and the Internet
Question for Programmers More Talented Than Myself
#1135 by caro (0.7638) posted on 11:47am Thursday, October 15th, 2009
I have 3016 PDF files. It took me 2 days to generate them because the program I am using takes forever to draw shit. I named them based on our ID numbers like PVAAS-22-345.pdf which our web people use to match them to schools on the website. These ID's are different than the clients ID #s (we use different numbers since our client tends to change them a lot) but our client would like me to send them the PDFs directly as well as be able to download them off the website we are uploading them to.
[Q]



So question is...if I have a map of our numbers to their numbers, what is an efficient way to rename 3016 files?
[Q]

Score: 0 points
Any particular reason?
#1141 by justin (0.9994) posted on 11:55am Thursday, October 15th, 2009
I have no idea how you'd do it in windows. What kind of format is your mapping? Two columns of an excel or something?
[Q]
Score: 0 points
Any particular reason?
#1142 by caro (0.7638) posted on 11:56am Thursday, October 15th, 2009
It can be in any format I want it to be in. If I have to use C or something that's fine.
[Q]

Score: 0 points
Any particular reason?
#1144 by briantech (1.0000) posted on 12:01pm Thursday, October 15th, 2009
I wouldn't bother renaming them. Who cares what the filename is?
[Q]



If you have the mapping, just write a quick lookup script that takes in the client ID of the PDF they want, finds out its corresponding PDF, and link it to them.
[Q]

Score: 0 points
Any particular reason?
#1146 by caro (0.7638) posted on 12:03pm Thursday, October 15th, 2009
They want me to FTP all the files to them. They can already get them one by one if they want.
[Q]

Score: 0 points
Any particular reason?
#1147 by justin (0.9994) posted on 12:04pm Thursday, October 15th, 2009
I love the idea of using C. Hitting a thumbtack with a sledgehammer!
[Q]



brb, coding.
[Q]
Score: 0 points
Any particular reason?
#1150 by justin (0.9994) posted on 12:13pm Thursday, October 15th, 2009

import java.io.File;
[Q]



public class FileRenamer {
public static final String SOURCE_DIR = "c:\\source\\";
public static final String DEST_DIR = "c:\\dest\\";
[Q]



public String[][] fileNameMapping() {
String[] firstRow = new String[] {"PVAAS-22-345", "ClientIDNumber"};
return new String[][] {firstRow};
}

public void rename() {
for (String[] row : fileNameMapping()) {
File source = new File(SOURCE_DIR + row[0] + ".pdf");
File dist = new File(DEST_DIR + row[1] + ".pdf");
source.renameTo(dist);
}
}

public static void main(String[] args) {
FileRenamer renamer = new FileRenamer();
renamer.rename();
}
}
[Q]



The file name mapping is just a 2 dim String array.
[Q]
Score: 0 points
Any particular reason?
#1151 by caro (0.7638) posted on 12:15pm Thursday, October 15th, 2009
hmm ok now i just gotta figure out how to use this....
[Q]

Score: 0 points
Any particular reason?
#1153 by justin (0.9994) posted on 12:17pm Thursday, October 15th, 2009
start > run > cmd
javac FileRenamer.java
java FileRenamer
[Q]
Score: 0 points
Any particular reason?
#1154 by justin (0.9994) posted on 12:18pm Thursday, October 15th, 2009
wasn't that long ago that you were a TA for this shit.
[Q]
Score: 0 points
Any particular reason?
#1155 by caro (0.7638) posted on 12:20pm Thursday, October 15th, 2009
i think 6 years qualifies as a significant amount of time. that was before i turned 21...so you can see i destroyed a lot of brain cells since then.
[Q]

Score: 0 points
Any particular reason?
#1156 by justin (0.9994) posted on 12:23pm Thursday, October 15th, 2009
You should backup the files or something. I didn't test at all.
[Q]
Score: 0 points
Any particular reason?
#1157 by caro (0.7638) posted on 12:24pm Thursday, October 15th, 2009
yeah no worries there are a few copies of this directory...
[Q]

Score: 0 points
Any particular reason?
#1158 by caro (0.7638) posted on 12:26pm Thursday, October 15th, 2009
yeah as i suspected none of my servers have a way to compile java
[Q]

Score: 0 points
Any particular reason?
#1159 by justin (0.9994) posted on 12:26pm Thursday, October 15th, 2009
your servers linux?
[Q]
Score: 0 points
Any particular reason?
#1160 by caro (0.7638) posted on 12:26pm Thursday, October 15th, 2009
no.
[Q]

Score: 0 points
Any particular reason?
#1161 by justin (0.9994) posted on 12:27pm Thursday, October 15th, 2009
that would have made it easier.
[Q]
Score: 0 points
Any particular reason?
#1162 by caro (0.7638) posted on 12:28pm Thursday, October 15th, 2009
it's ok i already told them that i was going on vacation so it's not happening any time soon
[Q]

Score: 0 points
Any particular reason?
#1164 by briantech (1.0000) posted on 1:50pm Thursday, October 15th, 2009
do they have python? ruby? perl?
[Q]

Score: 0 points
Any particular reason?
#1165 by briantech (1.0000) posted on 1:50pm Thursday, October 15th, 2009
hell you could do it with a bash script
[Q]

Score: 0 points
Any particular reason?
#1175 by justin (0.9994) posted on 3:10pm Thursday, October 15th, 2009
Thats why I asked if it was linux.
[Q]
Score: 0 points
Any particular reason?
Thread Listing » Electronics, Gadgets, and the Internet » Question for Programmers More Talented Than Myself

Post A Reply:

Powered by Metaforum ©2004-2017
Get your own Free AJAX Forum Messageboard by visiting the offical site.
.