"hadoop fs -test -d #{@to_dir}" would be better for this purpose.