Menu  Toggle search  [ ![](https://winscp-
static-746341.c.cdn77.org/assets/images/logos/logo.png?v=7032) WinSCP  Free
SFTP, SCP, S3 and FTP client  for  Windows  ](https://winscp.net/)

  * [ Home ](/eng/index.php)
  * [ News ](/eng/news.php)
  * [ Introduction ](/eng/docs/introduction)
  * [ Download ](/eng/download.php)
  * [ Install ](/eng/docs/guide_install)
  * [ Documentation ](/eng/docs/)
  * [ Forum ](/forum/)

Close

Search

Close

[ Documentation ](/eng/docs/start "Documentation") » [ Features
](/eng/docs/feature_index "Features") » [ Scripting ](/eng/docs/scripting
"Scripting") » [ Script Commands ](/eng/docs/scripting#commands "Script
Commands") »

#  keepuptodate command

[ Watches for changes ](/eng/docs/task_keep_up_to_date) in local directory and
reflects them on remote one.

  * Syntax 
  * Remarks 
  * Examples 
  * Converting to .NET Assembly 

_Advertisement_

##  Syntax

    
    
    keepuptodate [ <local directory> [ <remote directory> ] ]
    

##  Remarks

When directories are not specified, current working directories are
synchronized. To stop watching for changes press ` Ctrl+C ` .

If you do not want the synchronization to be aborted or interrupted by errors,
use command ` [ option batch continue ](/eng/docs/scriptcommand_option#batch)
` before starting.

Note: Overwrite confirmations are always off for the command.

Switches:

Switch  |  Description   
---|---  
` -delete ` |  Delete obsolete files.   
` -permissions=<mode> ` |  Set permissions ( [ SFTP ](/eng/docs/sftp) and [ SCP ](/eng/docs/scp) protocols only).   
` -nopermissions ` |  Keep default permissions.   
` -speed=<kbps> ` |  Limit transfer speed (in KB/s).   
` -transfer=<mode> ` |  ` binary|ascii|automatic `   
[ Transfer mode ](/eng/docs/transfer_mode) : binary, ascii (text), automatic
(by extension).  
` -filemask=<mask> ` |  ` <mask>[;<mask2>...] `   
Sets [ file mask ](/eng/docs/file_mask) .  
` -resumesupport=<state> ` |  ` on|off|<threshold> `   
Configures [ automatic resume/transfer to temporary filename
](/eng/docs/resume#automatic) .  
` -rawtransfersettings  setting1=value1  setting2=value2  …  ` |  Allows configuring any transfer settings using [ raw format ](/eng/docs/rawtransfersettings) as in an INI file. E.g. to enable preserving of directory timestamps, use ` -rawtransfersettings  PreserveTimeDirs=1  ` . The switch should come only after other parameters.   
  
_Advertisement_

Effective [ options ](/eng/docs/scriptcommand_option) : ` [ reconnecttime
](/eng/docs/scriptcommand_option#reconnecttime) `

XML  log elements: ` [ upload ](/eng/docs/logging_xml#upload) ` , ` [ touch
](/eng/docs/logging_xml#touch) ` , ` [ mkdir ](/eng/docs/logging_xml#mkdir) `
, ` [ chmod ](/eng/docs/logging_xml#chmod) ` (with ` -permissions  ` ), ` [ rm
](/eng/docs/logging_xml#rm) ` (with ` -delete  ` )

##  Examples

    
    
    [keepuptodate](https://winscp.net/eng/docs/scriptcommand_keepuptodate) -delete
    
    
    [keepuptodate](https://winscp.net/eng/docs/scriptcommand_keepuptodate) d:\www /home/martin/public_html
    
    
    [keepuptodate](https://winscp.net/eng/docs/scriptcommand_keepuptodate) -filemask="|*.bak; *.tmp"

##  Converting to .NET Assembly

There is no equivalent for ` keepuptodate ` command in [ .NET assembly
](/eng/docs/library) .

You can make use of ` [ System.IO.FileSystemWatcher
](https://learn.microsoft.com/en-us/dotnet/api/system.io.filesystemwatcher
"https://learn.microsoft.com/en-us/dotnet/api/system.io.filesystemwatcher") `
to run non-recursive synchronization using ` [ Session.SynchronizeDirectories
](/eng/docs/library_session_synchronizedirectories) ` , when change in local
directory occurs.

##  Contribute

![PayPal](https://winscp-
static-746341.c.cdn77.org/assets/images/paypal.svg?v=7032)

[ Donate ](/eng/donate.php)

  * [ $9 ](/eng/donate.php?amount=9&currency=USD&class=S "Donate $9 via PayPal")
  * [ $19 ](/eng/donate.php?amount=19&currency=USD&class=S "Donate $19 via PayPal")
  * [ $49 ](/eng/don