Search code examples
phpstorm

How to configure PhpStorm File Watcher to copy file


Is there a way to set up file watcher in PhpStorm on one file, that will copy that file to different location in project after file change/save?


Solution

  • You don't even need a batch/shell script for this as has been suggested in comments. You can just use xcopy.exe as a program. On Windows 10 it resides in C:\Windows\System32 folder.

    One way to set it up would be:

    Arguments: src\$FileName$ dist /iy

    Working directory: $ProjectFileDir$

    In this case you are copying top-level files from src directory to dist directory of your project. /i tells xcopy that the destination is a folder and /y supresses the prompt to confirm overwriting.