Trouble with date

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?

On Sat, Dec 1, 2012 at 7:19 PM, Pierre-Andre M. [email protected]
wrote:

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…

Thank you! That worked great

Am 02.12.2012 03:14, schrieb tamouse mailing lists:

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}”)

You can create the directories without relying on shell commands:

require ‘fileutils’
FileUtils.mkdir_p(save_path)

tamouse mailing lists wrote in post #1087485:
On Sat, Dec 1, 2012 at 7:19 PM, Pierre-Andre M. [email protected]
wrote:

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}”)

require ‘fileutils’
FileUtils.mkdir_p(save_path)

On Sun, Dec 2, 2012 at 2:38 AM, 7stud – [email protected] wrote:

FileUtils.mkdir_p(save_path)

\o/

There’s almost always a way to do something in ruby without
resorting to forking another process.