Skip to content

How to get a temp directory in any OS with Ruby

Robert Greiner
Robert Greiner

I needed this over the weekend and the existing online help is less than helpful. As it turns out, just like with everything I try to do in Ruby, the solution is simple.

require 'tmpdir'
temp = Dir.tmpdir() 
puts temp #C:/Users/Robert/AppData/Local/Temp

This is all built into Ruby, you don't need to install any gems or anything.

Please consider subscribing, it's free.
Technology

Robert Greiner Twitter

Professional optimist. I write a weekly newsletter for humans at the intersection of business, technology, leadership, and career growth.


Related Posts

Members Public

Artist for a Day

The future of creative output is multiplied by AI.

Artist for a Day
Members Public

The Auto Industry's Cloud Awakening

Auto manufacturers are behind the cloud adoption curve but are well-positioned to unlock the future of mobility by building foundational capabilities across six key areas.

The Auto Industry's Cloud Awakening
Members Public

Off Topic Thursday: Apple Keynote Event Reflections

Igor and Robert nerd out on the recent Apple Keynote Event from October 13th 2020 and share their reflections about exceptional production value, new products, and Apple’s evolution as an organization.