I need to transfer the latest file in a folder to aws server using a simple batch script. I am getting a date-stamped filename so ideally the largest file name should be the latest
The code used is as follows
@echo off
SET longfile =''
for %%a in (c:\Users\Admin\Desktop\batch\*) do (
if %%a GTR %longfile%
%longfile% = %%a
)
pscp -i c:\putty\pass.ppk %longfile% ubuntu@ec2-XXX-us-west-2.compute.amazonaws.com:/home/ubuntu/
The above script does not work as the pscp command returns the error file not found
.