It looks like you're new here. If you want to get involved, click one of these buttons!
Maybe someone will find this useful.
I wrote a script for my company that creates a new folder with the Windows username, a subfolder with the date, and moves the newly created PDF file into that folder. (Example: "J:\PDFs\Joe\2010-04-26\Some document.PDF")
It is useful for us because it automatically organizes all of the PDF's in one folder on a mounted network drive. PDFCreator is running locally with a copy of this script on each station, and not as a server. The username might not work the same if running in server mode.
' MovetoUserDateFolder
' License: GPL
' Date: April 26, 2010
' Author: uhcafigdc
<br />
' This script will -
' Create a new folder within the specified parent folder named by the Windows environment variable %USERNAME%
' Create a subfolder within that folder named by the current date yyyy-mm-dd
' Move the newly created PDF file into that folder
<br />
Option Explicit
Const AppTitle = "PDFCreator - Move to User Date folder"
Dim objArgs, objShell, objFolder, objFSO, wshShell, fname, parentfolder, newfolder, username
<br />
' SET PARENT FOLDER HERE
parentfolder = "J:\PDF\"
<br />
<br />
Set objArgs = WScript.Arguments
<br />
If objArgs.Count = 0 Then
MsgBox "This script needs a parameter!", vbExclamation, AppTitle
WScript.Quit
End If
<br />
fname = objArgs(0)
<br />
<br />
' Get the username
Set wshShell = WScript.CreateObject("WScript.Shell")
username = wshShell.ExpandEnvironmentStrings("%USERNAME%")
<br />
' Set the new folder name
newfolder = username & "\" & DatePart("yyyy",Date) & "-" & Right("0" & DatePart("m",Date), 2) & "-" & Right("0" & DatePart("d",Date), 2)
<br />
' Create the new folder
Call CreateFolder(parentfolder, newfolder)
Private Sub CreateFolder(pfolder, nfolder)
<span class="Apple-tab-span" style="white-space:pre"> </span>set objShell = CreateObject("Shell.Application")
<span class="Apple-tab-span" style="white-space:pre"> </span>set objFolder = objShell.NameSpace(pfolder)
<span class="Apple-tab-span" style="white-space:pre"> </span>objFolder.NewFolder nfolder
End Sub
<br />
' Move the file to the new folder
Call MovetoFolder(fname, parentfolder, newfolder)
Private Sub MovetoFolder(file, pfolder, nfolder)
<span class="Apple-tab-span" style="white-space:pre"> </span>Set objFSO = CreateObject("Scripting.FileSystemObject")
<span class="Apple-tab-span" style="white-space:pre"> </span>objFSO.MoveFile file, pfolder & nfolder & "\"
End Sub