when am executing the below recipe am getting the error message. My requirement is I need to "Move" only certain folders(log,tmp)from source to some other location only whenever folders are available in source, if not no need to move and successfully execute my resource. whenever am executing the below resource first time with source folders(log,tmp) it will execute successfully but when to run the same resource second time it throws error message because there are no folders(log,tmp) in source. I need to successfully execute even folders(log tmp) are not present in the source. can you share yours though on this requirement?
Below is my resource :
execute "move files" do
command "mv #{node["source"]}/log tmp #{node["dest"]}"
cwd node["direct"]
only_if do File.exist?(node['source']) end
end
Error message:
mv: cannot stat âlogâ: No such file or directory
mv: cannot stat âtmpâ: No such file or directory