Skip to content

Instantly share code, notes, and snippets.

@hpjaj
Last active August 29, 2015 14:10
Show Gist options
  • Save hpjaj/955320535f302e4172d9 to your computer and use it in GitHub Desktop.
Save hpjaj/955320535f302e4172d9 to your computer and use it in GitHub Desktop.
Week 3 - 3e - Directory Manipulation
# Returns the path to the current working directory,
# in the form of a string
Dir.getwd
# Creates a new working directory entitled 'tmp' within
# the current directory
Dir.mkdir("tmp")
# Changes the working directory to '/tmp'
Dir.chdir(File.join(Dir.getwd, "/tmp"))
# Alternate method to get the current working directory
Dir.pwd
# Go backwards (upwards) one directory
Dir.chdir("..")
# Delete the 'tmp' directory
Dir.delete("tmp")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment