script to upload files based on last uploaded file

May 1, 2014 at 04:10:53
Specs: Windows 7
Hi,

I need to make a script that will do this

1. It needs to connect to an SFTP server first, so it will have to use proxy authentication
2. it will upload all files on the folder
3. on the next day, the files are removed but we will leave only one file which is the latest file
4. the script will run again, but I don't want it to upload all files again, it will check what is the latest file and it should only upload new files

what do you think it is the best to do this? can it be done with a batch file?

Thank you


See More: script to upload files based on last uploaded file

Report •


#1
May 1, 2014 at 21:48:23
I think I get the "gist", but not sure about some details:
3. on the next day, the files are removed but we will leave only one file which is the latest file
4. the script will run again, but I don't want it to upload all files again, it will check what is the latest file and it should only upload new files

in 3 you said all the files are removed (from the working directory, I assume) except the latest one. But then in 4 you imply that those files (having earlier time-stamps) might still be present and need to be filtered. This perceived discrepancy would determine how the batch handles the filtration: skip the first (earliest) file and ftp the rest, or apply the date from the earliest file to filter files for uploading. The first case is easy: skip the first line of a date-sorted directory (the "flag" file). The second case, where other files with earlier dates might mix in, would require more attention, but still not real difficult to do: sort the dir. by date, but start FTP with all files following the "flag" file.
The login auth. has to be handled by FTP, (FTP /S scriptfile) not batch. Put the requisite authentication into the FTP-script file, then the batch can get you hooked up for FTP using the FTP-script.


Report •
Related Solutions


Ask Question