I want to create folder with todays date as the name of folder. Then, I want to move the data from remote machine to the newly created folder.
I have written a batch script which looks like
My batch script.
name: run.bat
::@ECHO off
SET CurrentDate= %date:~-4,4%_%date:~-10,2%_%date:~7,2%
SET CurrentDate=%CurrentDate: =%
"%SystemRoot%\System32\cmd.exe" /c mkdir "Z:\some_name_commercial\%CurrentDate%"
C:\Users\H213561\Documents\pscp.exe -l username -pw **** username@mftp.somename.com:/Distribution/somename_corp/* "Z:\some_name_commercial\%CurrentDate%"
The script is working fine, When I run the above script from command line it does what I intend to do. But I am unable to schedule the script in windows scheduler as a daily job.
what I tried!!!
I think the problem is with mkdir command, I tried giving a complete path like with no luck.
"%SystemRoot%\System32\cmd.exe" /c mkdir "Z:\some_name_commercial\%CurrentDate%"
P.S : Z:\ is the mounted NAS (network drive)
Update:
I am able to get this working, when my destination location is not a network drive. But task scheduler doesnt work, if it is a network drive.