Change to a newly created directory

Ruby Beginner

I have a command line script that captures a single argument and creates
a directory in that name. I then want to copy some directories inside
of this newly created directory.

I can't seem to figure out how to change to the new directory.

require 'FileUtils'

file_name = ARGV[0]

FileUtils.mkdir file_name # Creates top level directory

# I want this folder to be subdirectory of the newly created top-level
directory
FileUtils.mkdir_p '/images'

Thanks

John

···

--
Posted via http://www.ruby-forum.com/.

you can try:

file_path = ARGV[0]

FileUtils.mkdir_p file_path + '/images'

John William wrote:

···

Ruby Beginner

I have a command line script that captures a single argument and creates
a directory in that name. I then want to copy some directories inside
of this newly created directory.

I can't seem to figure out how to change to the new directory.

require 'FileUtils'

file_name = ARGV[0]

FileUtils.mkdir file_name # Creates top level directory

# I want this folder to be subdirectory of the newly created top-level
directory
FileUtils.mkdir_p '/images'

Thanks

John

--
Posted via http://www.ruby-forum.com/\.

Dir.chdir(directory_name)

···

--
Posted via http://www.ruby-forum.com/.

Great! thanks for your help.

John

···

--
Posted via http://www.ruby-forum.com/.