Ask Your Question

How to create directory / folders in windows using manifests

asked 2014-11-17 15:15:56 -0600

Renuka gravatar image

I was trying to create folder and file using manifests ,I could create file if the folder structure exists.If folder/directory is not exists ..the script is failing.

file { 'C:\Users\ABC\a\HelloWorld.txt': ensure => file, mode =>'0644', content => "Hello World", }

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-11-17 16:18:34 -0600

updated 2014-11-17 16:18:44 -0600

You need to ensure directories as well. Puppet is not going to automagically create the folders for a file. And a best practice is to use forward slashes instead of back slashes.

file { ['c:/users', 'c:/users/ABC', 'c:/users/ABC/a']: ensure => directory,}
edit flag offensive delete link more


Thanks.., for the response.

Renuka gravatar imageRenuka ( 2014-11-18 12:35:05 -0600 )edit

If this answers your question, please mark it as the answer. Thanks!

rob gravatar imagerob ( 2014-11-24 15:23:21 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-11-17 15:15:56 -0600

Seen: 3,164 times

Last updated: Nov 17 '14