The code you have is rather convoluted. In the docs
for MOVE I don't see anything about using wildcards.
Nor does it say anything about specifying a folder in
the Destination parameter.
But why are you trying to use DOS (console code)
anyway? You're calling WSHShell to run a DOS command
and then calling FSO to do the same thing! DOS is for
console windows.
When I try your code I get that the source and
destination are:
C:\CSIeSafeDFX\receive\DFX_LoansPastDueByPDR.xls
c:\treasury\Public funds\
That looks fine. If it's failing you should be getting
an error, like "file not found". Your post implies that
you're not seeing an error code. If I were you I'd clean
it up, get the CMD code out of there, and use
FSO.FileExists where necessary so that you can check
where the operation fails.
--
--
"Michael Astrosky" <mastro
...@gmail.com> wrote in message
news:e12ceae3-bcb4-4589-a6b4-8125f87041c9@googlegroups.com...
I ave a long filename with many extranneous characters in it that needs to
be lessened and have yesterdays date appended in it. I figured that part
out - thanks to Goolge. I need to then move the file from it present
location to naother network location - this is the part I fail on
repeatedly. I believe it is due to the file not actually being created but
just a variable being defined. I have looked at this for so long I am not
seeing the error. Can anyone point point my (probably) simply overlook?
I beleive all the parts you need are posted below -
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objMessage = CreateObject("CDO.Message")
Set objShell = WScript.CreateObject("WScript.Shell")
Set objshell = CreateObject("Wscript.shell")
'On Error Resume Next
'Get current date
'-----------------------
strMonth = Month(Date)
If len(strMonth) = 1 Then
strMonth = "0" & strMonth
End if
strDay = Day(Date)
If Len(strDay) = 1 Then
strDay = "0" & strDay
End if
strYear = Year(Date)
'strHour = Hour(Time)
'strMinute = Minute(Time)
'strSecond = Second(Time)
strDate = strYear & strMonth & strDay
strPastDay = strDate -1
'-----------------------
'-------------------------------------------------------------------------- --
'Specify variables for Emails
'-------------------------------------------------------------------------- --
strScriptServer = "TECHOPSPC01"
strScriptPath = "\\TECHOPSPC01\C$\Scripts\CSI\Capture\..."
strScriptName = "DFX_Loans_Past_Due file Move to FSCHAUNI01"
'strToEmail = ""
'strCCEmail =
strProcessID = "[LPDR-01]"
strCustomerImpact = "LOW"
strCorporateImpact = "LOW??"
'-------------------------------------------------------------------------- --
'Specify variables for File Paths
'strFromPath1 = "\\techopspc01\C$\CSIeSafeDFX\receive"
'strToPath1 = "\\fschauni01\group_share\special assets retail\special
assets\past due report\"
strFromPath1 = "C:\CSIeSafeDFX\receive"
strToPath1 = "c:\treasury\Public funds\"
'Specify variable for File
strFile1 = "DFX_Loans Past Due by PDR*.xls"
strNewFile1 = "DFX_LoansPastDueByPDR"
'#######################'
If Right(strFromPath1, 1) <> "\" Then
strFromPath1 = strFromPath1 & "\"
End If
objShell.Run "cmd /c move ""C:\CSIeSafeDFX\receive\DFX_Loans Past Due by
PDR*.xls"" C:\CSIeSafeDFX\receive\DFX_LoansPastDueByPDR"
Wscript.Sleep 4000
strNewFile2 = "DFX_Loans Past Due By PDR" & strPastDay & ".xls"
strNewFile2 = strNewFile1 & strPastDay & ".xls"
objFSO.CopyFile strFromPath1 & strNewFile2, strToPath1, True
' objFSO.DeleteFile strFromPath1 & NewFile1
blnEmailNotification = true
Thank you all.