- cndesu
- Joined:
- Posts:
- 9
downloading all files even with filemask
Advertisement
The above is my script. It downloads all files irrespective of my filemask. Any help? I need to download only the files from remote server in last three days. The remote fileserver has 15 days of files.
Advertisement
-
martin◆
Site Admin - Joined:
- Posts:
- 41,454
- Location:
- Prague, Czechia
Re: downloading all files even with filemask
I do not understand your question. Which of your four
get
commands have the problem? Your only command that has -filemask
switch is not even valid, it won't download anything. Maybe you wanted this?
get -filemask=">=3D" Crush_Report_Log*.xlsx
- cndesu
- Joined:
- Posts:
- 9
Sorry I have to be more descriptive.
This is the script I have.
First three lines are working fine.
The problem is at fourth line
Based on the FAQ, it said "*>=3D" so used that principle. I will try this as you said.
This is the script I have.
cd / get -delete EOF_Report_Log*.xlsx get -delete Ext_Report_Log*.xlsx get -filemask="Crush_Report_Hourly*.xlsx>=3D" get -delete Prep_Report_Log*.xlsx get -delete Steam_and_Gas_Log*.xlsx close exit
The problem is at fourth line
get -filemask="Crush_Report_Hourly*.xlsx>=3D"
get -filemask=">=3D" Crush_Report_Hourly*.xlsx
As I said, this line pulling all files like others, filemask is not working. No difference between the above two lines.
-
martin◆
Site Admin - Joined:
- Posts:
- 41,454
- Location:
- Prague, Czechia
Please attach a full session log file showing the problem (using the latest version of WinSCP).
To generate the session log file, use
/log=C:\path\to\winscp.log
command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.Advertisement
- cndesu
- Joined:
- Posts:
- 9
I am enclosing the log file here.
-
martin◆
Site Admin
OK, but can you name a file that it is downloading, but it should not? I cannot investigate 20 thousand lines of logs file. Normal-level log file would be enough for this purpose.
- cndesu
- Joined:
- Posts:
- 9
Hi,
I enclosing the screenshots of the batch file where it is asking to run the winscp script. I also enclosed the screenshot of the command prompt what I am getting. I have enclosed the list of files in the remote server in another post.
May be this helps. I have highlighted in the screenshots.
Thanks
I enclosing the screenshots of the batch file where it is asking to run the winscp script. I also enclosed the screenshot of the command prompt what I am getting. I have enclosed the list of files in the remote server in another post.
May be this helps. I have highlighted in the screenshots.
Thanks
- cndesu
- Joined:
- Posts:
- 9
OK, but can you name a file that it is downloading, but it should not? I cannot investigate 20 thousand lines of logs file. Normal-level log file would be enough for this purpose.
Advertisement
-
martin◆
Site Admin
I'm sorry, but I do not think that you have given me the information I have asked for. Can you give me a name of one example file that was downloaded, although you believe it should not have been downloaded.
- cndesu
- Joined:
- Posts:
- 9
No file is downloaded which is not asked for. Sorry to say or ask, at the same time no file is downloaded which is asked for.
I have asked for last three days files. The files were formatted with a generic name, and
Thanks
I have asked for last three days files. The files were formatted with a generic name, and
yyyymmddhhmmss.xlsx
. I like to pull/get last three days files based on the timestamp concept which you have defined. Let me know if the syntax is wrong, as I am not seeing any files. With wild character I am seeing all the files.
Thanks
Anyway I made little bit changes onto my program and tried with interval as recent files in three days is working.
Thanks for the help.
Thanks for the help.
-
martin◆
Site Admin
The script you have posted above downloads file by their modification timestamps. Now it seems that you want to download by timestamp in their file names. That's a different thing. Anyway, if you have resolved your problem, can you share your solution?
Advertisement
- cndesu
- Joined:
- Posts:
- 9
The modifications I did was on the server. I changed
Thanks for help.
get
command to filename>3D
as the syntax. Previously the uploader software at the remote server used to dump all the 10 days files (total to 120) at one time. Syntax >3D
did not work as timestamp was on same day. So trying with filename format which did not work either. Now everyday the server has files from previous day. Now the file time stamps are different. So syntax >3D
worked. I do not know why the filename syntax with timestamp and wild character did not work.
Thanks for help.
-
martin◆
Site Admin - Joined:
- Posts:
- 41,454
- Location:
- Prague, Czechia
WinSCP does not have a syntax for time ranges based on file names.
But you can explicitly name set of days, like this (just an example, has to be adjusted for the real timestamp and name formats):
See https://winscp.net/eng/docs/scripting#timestamp
But you can explicitly name set of days, like this (just an example, has to be adjusted for the real timestamp and name formats):
# today's files get Crush_Report_Hourly%TIMESTAMP#yyyy-mm-dd%.xlsx # yesterday's files get Crush_Report_Hourly%TIMESTAMP-1D#yyyy-mm-dd%.xlsx # day-before-yesterday's files get Crush_Report_Hourly%TIMESTAMP-2D#yyyy-mm-dd%.xlsx
Advertisement
You can post new topics in this forum