One to Many Renaming & Copying
March 1, 2010 9:43 AM   Subscribe

Looking for a utility to take a single original file, and make multiple copies of that file with different file names, pulled from a list.

We have an original PDF file, let's call it original.pdf. We also have a list of names in an excel spreadsheet. We will be sending the PDF file to the people in the list - that part is taken care of already.

The trick comes in, in that we would like to watermark the PDF files with the recipient's name, before we send it to them. We already have a utility that will watermark the PDF with the name of the PDF file itself, so that part is easy. The naming of the file when sending it as an attachment is also easy, as our distribution program handles that.

The trick at this point is taking the original PDF file, and making multiple copies, using the list to determine the file name for each new copy. There are plenty of file renaming utilities out there, but I don't see anything that will make a copy of one original, and pull the name of the copy from a data source. The original file must be a PDF, as it is the combined output from multiple other apps that result in one file.

Thank you!
posted by GJSchaller to Computers & Internet (7 answers total) 1 user marked this as a favorite
This is the sort of thing that can be put together in a Perl or bash script on Unix in about five minutes by somebody with a modicum of expertise. Unfortunately, explaining all the details (and potentially walking through the installation of scripting languages, shells, etc.) to somebody with no programming experience is a multi-hour if not multi-day project.

I would advise you to locate a Unix person in your organization and bribe him/her with beer and/or snacks. If you go this route, I'd also recommend making your input files plain text rather than Excel spreadsheets.
posted by letourneau at 10:02 AM on March 1, 2010 [1 favorite]

The Bulk Rename Utility will rename (but not create additional copies of) a file based on an input text file.

With a little cleverness, you may be able to pull off what you're trying to do with a few intermediary steps. There is a command line utility which may be used as part of a batch file that could handle some of the other things, but I don't know if the command line tool will create multiple copies for you.

If you can get multiple copies of the file, Oscar's File Renamer allows you to treat a file name list like a text file, so it's fairly easy to copy First Name Last Name.pdf on top of the list of files and then hit save.

The tricky part, as far as I can tell, is getting the multiple copies of the same PDF in the first place. Renaming them becomes easy once you can do that.
posted by MesoFilter at 10:05 AM on March 1, 2010

Best answer: Creating a batch file via Excel is probably the quickest/dirtiest way:

1. Open a new blank spreadsheet. Paste the list of filenames into Column A. Make sure they all end in the appropriate extension (.pdf, in this case).

2. In cell B1, enter the following formula (modified to contain values relevant to you, of course): ="copy&" "&"C:\BlahBlah\OriginallyNamedFile.pdf&" "&"C:\NewBlahBlah\"&A1

3. Click and drag the little fill handle in the lower right-hand corner of B1 allllll the way down Column B until you reach the end of the list of file names in Column A.

4. Copy and paste the contents of Column B into a new text file; save it with a .BAT extension.

5. Double-click the new batch file to let 'er rip.

I just tested this; works great.
posted by julthumbscrew at 10:15 AM on March 1, 2010 [1 favorite]

Best answer: Whoops - should've read: ="copy"&" "&"C:\BlahBlah\OriginallyNamedFile.pdf"&" "&"C:\NewBlahBlah\"&A1 (I concatenated the spaces separately to make the fact that there WERE spaces more noticeable).
posted by julthumbscrew at 10:38 AM on March 1, 2010 [1 favorite]

You can run bash and perl on Windows too. To run bash, install Cygwin. To run perl, download it free from Activestate. letourneau is right though, one could write a script in bash or perl to do what you need in about 5 minutes.
posted by jockc at 10:45 AM on March 1, 2010

Response by poster: The Excel Batch file sounds good - the team working on this are already familiar with Excel, so this would be a snap. Thank you for the innovative idea!
posted by GJSchaller at 10:53 AM on March 1, 2010

Best answer: The excel cludge-batch-file is a time-honoured technique, however there's an even better way to accomplish step 3: instead of dragging the 'little fill handle' (the + cursor), double-click it. This will automatically fill Column B all the way down to the end of Column A.
posted by coriolisdave at 3:11 PM on March 1, 2010

« Older New crime novels for my mum   |   All things considered, I'd prefer not to be left... Newer »
This thread is closed to new comments.