need synchronize the directories and files of 2015, but not the entire year, just May and Sept.

Advertisement

leonardo07746
Joined:
Posts:
11
Location:
cuba

need synchronize the directories and files of 2015, but not the entire year, just May and Sept.

good afternoon, now I suddenly need to re-write my script and need to add a feature that might synchronize the directories and files from two months within the past year 2015, I'm still reading Newer and updated files only under https://winscp.net/eng/docs/ui_transfer_custom#other but it keeps my head spinning, still don't know whether I'm on a good lead article or not.help,thanks
_________________
leo

Reply with quote E-mail

Advertisement

leonardo07746
Joined:
Posts:
11
Location:
cuba

Re: need synchronize the directories and files of 2015, but not the entire year, just May and Sept.

martin wrote:

Use a file mask with a time constraint:

synchronize C:\local /remote -filemask="*>=2015-05-01<2015-06-01,*>=2015-09-01<2015-10-01"

See https://winscp.net/eng/docs/file_mask#size_time





Many many thanks, then my script must to say something like this:

winSCP.com /command ^
"option batch abort" ^
"open ftp://ftpmetropolitano:ftpmetro@192.168.x.x/" ^
"synchronize local -filemask="*>=2016-06-01 00:00:00" C:\Sabic\JOURNAL /Journals/TRASVAL/" ^
"/log=C:\LOGS_JOURNALS\logsdelScript_!Y_!M_!D_!T.log" /loglevel=1 "
"close" ^
"quit"

the date've changed because my crazy bosses said they're more interested in the files updated after Jun, is the sintaxis of the script all right?
thanks
_________________
leo

Reply with quote E-mail

leonardo07746
Joined:
Posts:
11
Location:
cuba

Re: need synchronize the directories and files of 2015, but not the entire year, just May and Sept.

leonardo07746 wrote:

martin wrote:

Use a file mask with a time constraint:

synchronize C:\local /remote -filemask="*>=2015-05-01<2015-06-01,*>=2015-09-01<2015-10-01"

See https://winscp.net/eng/docs/file_mask#size_time





Many many thanks, then my script must to say something like this:

winSCP.com /command ^
"option batch abort" ^
"open ftp://ftpmetropolitano:ftpmetro@192.168.x.x/" ^
"synchronize local -filemask="*>=2016-06-01 00:00:00" C:\Sabic\JOURNAL /Journals/TRASVAL/" ^
"/log=C:\LOGS_JOURNALS\logsdelScript_!Y_!M_!D_!T.log" /loglevel=1 "
"close" ^
"quit"

the date've changed because my crazy bosses said they're more interested in the files updated after Jun, is the sintaxis of the script all right?
thanks



nah, not that way, that way it saved the files to C:\program files\Winscp\ instead to the location that I'm indicating to save them c:\sabic\journal\, I changed it by doing some research and this did the magic:

winSCP.com /command ^
"option batch abort" ^
"open ftp://ftpmetropolitano:ftpmetro@192.168.x.x/" ^
"synchronize local C:\Sabic\JOURNAL /Journals/TRASVAL -filemask=*>"2016-09-20 08:10:00" ^
"/log=C:\LOGS_JOURNALS\logsdelScript_!Y_!M_!D_!T.log" /loglevel=1 "


Voila!! thanks
_________________
leo

Reply with quote E-mail

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: need synchronize the directories and files of 2015, but not the entire year, just May and Sept.

The actual problem are the quotes.

This is correct:
"synchronize local C:\Sabic\JOURNAL /Journals/TRASVAL -filemask=""*>2016-09-20 08:10:00""" ^
And then the argument order does not matter. This would still work:
"synchronize local -filemask=""*>2016-09-20 08:10:00"" C:\Sabic\JOURNAL /Journals/TRASVAL" ^
See https://winscp.net/eng/docs/commandline#syntax

In your version, I'm pretty sure that the "08:10:00" part was ignored.

Also, the /log must be at the very end (or before the /command). Otherwise the close and exit commands are never invoked.

So a full correct script is like:
WinSCP.com /command ^
  "option batch abort" ^
  "open ftp://ftpmetropolitano:ftpmetro@192.168.x.x/" ^
  "synchronize local ""-filemask="*>=2016-06-01 00:00:00"" C:\Sabic\JOURNAL /Journals/TRASVAL/" ^
  "close" ^
  "quit" ^
  /log="C:\LOGS_JOURNALS\logsdelScript_!Y_!M_!D_!T.log" /loglevel=1

Reply with quote

Advertisement

You can post new topics in this forum