Dim strSource, strDest, objFSO, objFile
strSource = "\\server1\Transcription\Completed Voice Files"
strDest = "\\server1\transctiption\archived voice files\" & SortableDate() & "\"
Set objFSO = CreateObject("Scripting.FileSystemObject")
WScript.Echo "Destination folder = " & strDest
For Each objFile In objFSO.GetFolder(strSource).Files
WScript.Echo " Moving file " & objFile.Name
objFSO.MoveFile objFile.Path, strDest & objFile.Name
Next
Function SortableDate
Dim strTemp
'Generate a sortable date: YYYY-MM-DD
strTemp = Year(Now)
If Len(Month(Now)) = 1 Then
strTemp = strTemp & "-0" & Month(Now)
Else
strTemp = strTemp & "-" & Month(Now)
End If
If Len(Day(Now)) = 1 Then
strTemp = strTemp & "-0" & Day(Now)
Else
strTemp = strTemp & "-" & Day(Now)
End If
SortableDate = strTemp
End Function
Open in new window
~bp