2012-09-19 5 views

Répondre

1

Je suis allé pour:

Dir.foreach(myPath) do |item| 
    next if item == '.' or item == '..' or item == mySubDir 
    FileUtils.rm_rf File.join(myPath, item) 
end 
+1

semble bon. Si vous voulez que votre code fonctionne même si myPath ne se termine pas par un '/', alors utilisez 'File.join (myPath, item)' au lieu de 'myPath + item' –

+0

Merci Wayne! :) – Turowicz

Questions connexes