You can "ensure" that the file at target location exists and provide the file to be copied as source in file type. A partial code snippet only showing relevant parts:
file { 'E:\mycopy\folder\filename':
ensure => present,
source => "d:\temp\test.txt",
}
Check the documentation of file type here and how source attribute behaves here. Now this will work with a few caveats :
- If you are using absolute file path as source - then the file should be present on agent machine
- If you are serving file from Puppet's file server then the source file should be in appropriate location in puppet's file server.
But what is your exact purpose? Similar thing can be achieved with content
attribute of file type or other attributes