Skip to main content

Benjamin Oakes

Photo of Ben Oakes

Hi, I'm Ben Oakes and this is my geek blog. Currently, I'm a Ruby/JavaScript Developer at Liaison. Previously, I was a Developer at Continuity and Hedgeye, a Research Assistant in the Early Social Cognition Lab at Yale University and a student at the University of Iowa. I also organize, ICRuby, OpenHack Iowa City, and previously organized NewHaven.rb. I have an amazing wife named Danielle Oakes.

Filtering for the Shell category. Clear

Filter a list of paths to those that exist

by Ben

If you have a file containing paths, but only some of them exist, you can filter them down to only the ones that exist using this command:

ls -1 $(cat list-of-files.txt) > list-of-files.txt

For example, this is useful for comparing branches in git. You could run all the specs that changed between two branches, ignoring the spec files that were removed.