Half an hour ago, I had about 60 files that had the same irritating prefix to the filename. I wanted to drop the prefix so the reader could see the significant portion of the filename first. There is no way that I would rename that many files by hand and not mess one up.
bad_path=/my_redundant_path/
def rename(file,path)
new_file = file.sub(path,”)
system(”p4 integrate #{file} #{new_file}”)
system(”p4 delete #{file}”)
endDir["*.build"].each do |old_file|
rename(old_file,bad_path) if old_file.match(bad_path)
end
Two minutes spent playing with ruby goes a long way.
Related posts:
- The quest for a decent Ruby Continuous Integration tool Git has become very popular in the Ruby community. Github...
- Every Continuous Integration server that supports Ruby + Git As I posted, I’m on a quest for the...
Related posts brought to you by Yet Another Related Posts Plugin.