Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Get files Based on date what you want (SFTP connection)

So just convert one format to the other.

Like:

echo Inputdate(YYYY-MM-DD)

set /p CAR=
set CAR_MMDDYYYY=%CAR:~5,2%%CAR:~8,2%%CAR:~0,4%


See https://ss64.com/nt/syntax-substring.html

Though this has no longer anything to do with WinSCP.
Guest

Re: Get files Based on date what you want (SFTP connection)

martin wrote:

get -filemask="*>=%car%<=%car% 23:59:59" /media/4B90C3C70BA785A7/melvin.luching C:\SMARTVISTA\%car%



Hi Sir,

I Cant copy the file inside the folder of the date I input this is the script I used:

get -filemask="*>=%car%<=%car% 23:59:59" /media/4B90C3C70BA785A7/melvin.luching/copy1tolocal/reports/%car% C:\SMARTVISTA\%car%\reports

the filename format of the folder is 03302016 but the date format need to Input in my script is YYYY-MM-DD format, when I try to change that to MMDDYYYY I can copy the folder but the file created in the input date didn't copy.

I uploaded the picture of the directory of my ftp server thanks,

Melvin.
martin

Re: Get files Based on date what you want (SFTP connection)

get -filemask="*>=%car%<=%car% 23:59:59" /media/4B90C3C70BA785A7/melvin.luching C:\SMARTVISTA\%car%[/quote]
Guest

Re: Get files Based on date what you want (SFTP connection)

martin wrote:

You have to use the car in your -filemask. And the car has to be in format YYYY-MM-DD, not YYYYMMDD:

get -filemask="*>=%car%" /media/4B90C3C70BA785A7/melvin.luching C:\SMARTVISTA\%car%


Hi Sir Martin.

How to get the files only that I inserted date. because this script give me a all files after the inserted date
eg: i want to get 05-30-2016 but the script was getting from 05-30-2016 up to date today.

Thanks,
martin

Re: Get files Based on date what you want (SFTP connection)

You have to use the car in your -filemask. And the car has to be in format YYYY-MM-DD, not YYYYMMDD:

get -filemask="*>=%car%" /media/4B90C3C70BA785A7/melvin.luching C:\SMARTVISTA\%car%
ebensalot

Get files Based on date what you want (SFTP connection)

Good day Winscp Supports,

I want to copy a file from the server based on date user inserted

this is the script I used but all files will get not the the date I input:

this is the .bat file to call the winscp script:


@echo off

:main
echo Inputdate(YYYYMMDD)
set /p car=
if %car% == 1 goto date

mkdir "C:\Documents and Settings\asd\Desktop\%car%"
WinSCP.com /script=sample.txt
pause


And this is the winscp script:

option batch abort
option confirm off


open sftp://username:password@Ip ADd -hostkey="ssh-rsa 2048 c5:89:02:bd:ce:66:ec:18:e2:10:b6:40:2f:81:a0:a6"


get -filemask="*>=%TIMESTAMP#yyyy-mm-dd%" /media/4B90C3C70BA785A7/melvin.luching C:\SMARTVISTA\%car%

exit