From: tamouse mailing lists Date: 2012-12-02T11:14:19+09:00 Subject: Re: Trouble with date On Sat, Dec 1, 2012 at 7:19 PM, Pierre-Andre M. wrote: > Im trying to incorporate the date into a directory path > > I want to name a folder using the bash command "date +%y%m%d" and then > call that path later on in the script as in: > > # This works great > today = `date +%y%m%d` > directory = "mkdir -p /Users/me/github/splat/`date +%y%m%d`" > exec directory > > > #This part doesnt work > > command = "git clone --mirror https://github.com/org/#{repo_name}.git > /Users/me/github/splat/`date +%y%m%d`/#{repo_name}/" > exec command > > As I understand it when the backticks are used it opens a sub shell, how > can I get that directory name? > > -- > Posted via http://www.ruby-forum.com/. > Seems to be going a long way 'round something pretty simple. today = Time.now.strftime("%Y%m%d") save_path = "/Users/me/github/splat/#{today}" system("mkdir -p #{save_path}") # ... later system("git clone --mirror https://github.com/org/#{repo_name}.git #{save_path}/#{repo_name}") Adjust scope on variables as necessary...