change to a newly created directory

J

John William

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
 
P

Parv G.

you can try:

file_path = ARGV[0]

FileUtils.mkdir_p file_path + '/images'


John said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,059
Latest member
cryptoseoagencies

Latest Threads

Top