?
Solved

batch file find, rename, move, convert to pdf

Posted on 2010-09-10
8
Medium Priority
?
622 Views
Last Modified: 2012-05-10
I've been given the task to query for files across various network drives, rename them, move them into different directories, and then convert them to pdf files.

Any ideas, suggestions, strategies, software...???

0
Comment
Question by:KLLtar
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 33647402
What type of files?

I use Imagick's CONVERT (http://www.imagemagick.org/script/index.php) to process TIFF/JPG/faxes/etc files into PDFs.

As for scanning across the drives, you would need to have a list of drives and possible file types.

Is this a one of task, or something you are going to run on a regular basis?
0
 

Author Comment

by:KLLtar
ID: 33649491
The files are a mixed breed - .xls, .doc, .pdf, .jpg, ppt,....

Right now, we're quering network drives and finding matches based on known keywords, but when we find them, we need to move them into a different directory, batch rename them (like projectName), and then convert them into pdf files.

We have over 11,000 files to processs.

Hopefully, this is a one time job!
0
 
LVL 6

Expert Comment

by:judgeking
ID: 33655834
I use Win2PDF (www.win2pdf.com).  Basically it's installed as a printer, but creates PDF documents.  They also have a product (http://www.win2pdf.com/products/products.htm) called Batch2PDF that 'converts entire directories of .doc, .html, .txt and .rtf files to PDF files'
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 15
ID: 33669370
I believe you are looking for something along these lines, perhaps this exactly.  (Please see the attached script.)

NOTE:  I am using PDF Creator simply because it is free and because it is installed on all of my machines by default, and therefore I am somewhat familliar witht eh syntx.  If you have a different PDF Creation mechanism you would prefer to use simply substitute it's commands as necessary.
You can Download PDF Creator here for free:  HTTP://Sourceforge.net/Projects/PDFCreator/

@ECHO OFF
SET RemotePathList="\\Nas1\share1\Folder", "\\Nas1\share2\Folder", "\\Nas2\share1\Folder"
SET "FileMask=*.xls"
SET "ProjectName=ProjectX"
SET "ProjectPath=\\Nas3\Share4\Folder Five\ProjectX Folder"
SET "PDFCreatorPath=C:\Program Files\PDFCreator\PDFCreator.exe"

::Finds Files, Copies them to the project directory and int he process renames them.
FOR %%L IN (%RemotePathList%) DO FORFILES /P "%%L" /S /M %FileMask% /C "cmd /c COPY /Z "@Path\@File" "%ProjectPath%\ProjectName_@File""
:: Note in the above statement we don;t trap errors, they will echo to the command prompt for now.

:: Here we convert the renamed files to PDF and delete the files we copied int he last step
FOR /F "Tokens=1-2 del%%P IN ('DIR /A:-D /B "%ProjectPath%" ') DO "%PDFCreatorPath%" /PF"%ProjectPath%\%%P" && DEL /F /Q "%ProjectPath%\%%P"
:: Note in the above statement we don't trap errors, they will echo to the command for now; and if a file is NOT converted it should not be deleted.

Open in new window

0
 

Author Comment

by:KLLtar
ID: 33671845
QCubed,

What language is the code written in? Does in run in WIn XP environment?
If so, do I just save the code in a file with a .bat extension and then run it from the command line?
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 33671999
That is a .BAT file.
0
 
LVL 15

Accepted Solution

by:
Ben Personick (Previously QCubed) earned 2000 total points
ID: 33672197
The "code" is "windows commandline" aka "batch" aka "bat" and will run on windows XP.  Just copy the 'code' and save it as say "MovePDF.bat" then open that file in Notepad++ or whatever text editor you more prefer and edit the variabls at the top to hold values appropriate for your environment.

Please Note:  It is Always good practice to test a script before you run it on production data -- There may be syntax issues (a forgotten quote or parentethis or the ilk) because I did not test run the script.  Please make your own test folder with your own documents and report back any errors.
0
 
LVL 15
ID: 33810454
Hey, thanks for the points! ^^

~Q
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
AutoHotkey is an excellent, free, open source programming/scripting language for Windows. It started out as a keyboard/mouse macros product, but has expanded into a robust language. This article provides an introduction to it, with links to addition…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question