SecureArtisan

My Road to Digital Forensics Excellence

OutsideIn Part4

Posted by Paul Bobby on November 2, 2010

Just a quick addendum.

I ran the OutsideIn-PDF tool to produce PDFs (for further combination in to a PDF portfolio) and ran in to filename problems with my batch files – when those filenames have spaces in them.

Here is some VB script that can be executed from the current folder that replaces all spaces with underscores. (Shamelessly ripped from some place in Google Cache land).

dim objFileSys, file, folderName, folderObj, fileColl, objRegEx, newFile

set objFileSys = CreateObject("Scripting.FileSystemObject")
folderName = "."

set folderObj = objFileSys.GetFolder(folderName)
set fileColl = folderObj.Files
set objRegEx = new RegExp

objRegEx.Pattern = " "
objRegEx.Global = true 

for each objFile in fileColl
 newFile = objRegEx.Replace(objFile.Name, "_")
 objFileSys.MoveFile objFile, folderName & "\" & newFile
next

 

Advertisements

One Response to “OutsideIn Part4”

  1. A. Thulin said

    The spaces-in-filenames problem is often possible to fix by using quotes around the file name parameter in scripts.

    In Runner.bat, I would experiment with using “%1″/”%2” (or perhaps “%1/%2”) in the exredir command line. That should, I suspect,
    ensure that that particular value is treated as single argument, and not split at filename spaces.

    A related problem is filenames containing ‘&’.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: