Ask Your Question
0

how to create a folder in the name which stored in the variable? (windows)

asked 2016-04-06 05:19:57 -0500

yoga gravatar image

I stored the folder name in variable . Then i use that variable in my manifest to create a folder. But it create folder in the name of variable name not what is in that variable.

Eg:

       class currentgen::backup::folder_backup
      ($prodequ_backup_loc        = $prodequ_backup_loc,
       $time=yoga,
       )
       inherits currentgen{
                  exec{"current date time folder":
                           cwd=>"${prodequ_backup_loc}",
                           command=>'C:\Windows\System32\cmd.exe /c "md $time"',
                          }

above code create the directory name of "$time".

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-04-08 00:11:56 -0500

yoga gravatar image

By using File resource ,can able to create folder which name stored in variable. code below:

class currentgen::backup::folder_backup
($prodequ_backup_loc        = $prodequ_backup_loc,
  $time=$::windows_time,
 ) {
file{"${prodequ_backup_loc}\\${time}":,
      ensure => directory,
     }
 }
edit flag offensive delete link more

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

Stats

Asked: 2016-04-06 05:19:57 -0500

Seen: 116 times

Last updated: Apr 08 '16