The selected answer will not work on Windows or systems where Bash is the default interpreter. You should use a cross-platform Ruby solution (and faster, since there is no process there):
directory '/var/www/html' do
action :delete
not_if { File.symlink?('/var/www/html') }
end
source
share