1

I recently recovered many deleted files by using a tool called photorec - http://www.cgsecurity.org/wiki/PhotoRec

Great life saver. Only problem is that recovered files have their names replaced by some random string that this program generates. (File name and directory structures were lost due to user deletion of the files).

So I ran another program called photorecsorter to sort recovered files into folders by their file extensions (pdf in one folder, ppt in another and so on) http://builtbackwards.com/projects/photorec-sorter/

I recovered around 100K+ files so I can't ask user to open files and look at the content to find what they're looking for. I know in word document file metadata (headers) can help me to retrieve two key elements of information which can be then used to rename that file - Title of the word document and last date modified. Once I know how to this for word doc, maybe I can do it for other office extensions and pdf on my own. I looked for some tools online but before I try something - I wanted to see what experts may suggest here.

Thanks

1 Answer 1

2

A VBS (VBScript) file like the following should help for Word documents at least:

Option Explicit

Dim objWord, objDoc

Set objWord = CreateObject("Word.Application")
objWord.Visible = False
objWord.DisplayAlerts = False
objWord.Documents.Open "C:\MyDoc.docx", False, True ' path, confirmconversions, readonly
Set objDoc = objWord.ActiveDocument

MsgBox "Title: """ & objDoc.BuiltInDocumentProperties("Title") & """"
MsgBox "Subject: """ & objDoc.BuiltInDocumentProperties("Subject") & """"
MsgBox "Author: """ & objDoc.BuiltInDocumentProperties("Author") & """"
MsgBox "Creation Date: """ & objDoc.BuiltInDocumentProperties("Creation Date") & """"
MsgBox "Last Save Time: """ & objDoc.BuiltInDocumentProperties("Last Save Time") & """"

objWord.Quit 0 ' wdDoNotSaveChanges
Set objWord = Nothing
Set objDoc = Nothing

You can use FileSystemObject to iterate through all the DOC/DOCX files in a directory, and rename them based on the property strings returned.

For Excel or PowerPoint files, use Excel.Application or PowerPoint.Application when you create the document objects. If you get stuck just search the net for relevant Office automation VBScript tutorials.

There's no general method to retrieve metadata for all file formats obviously, so other formats such as PDF will require an entirely different solution. I recommend you search the net or post a new question if you need help with it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .