18
我試圖將其所有子文件夾從源文件夾複製到目標文件夾。 下面的代碼似乎沒有做到這一點。我能夠通過使用僅複製文件而不是子文件夾ruby將文件夾與子文件夾複製到目標位置
FileUtils.cp_r(Dir["/Volumes/TempData/Collects/Sasi/android/*.*"],"/Volumes/Data/Apps/android")
什麼是我失蹤?
require 'fileutils'
puts "operating_system"
operating_system = gets.chomp
if operating_system == "android" then
FileUtils.cp_r(Dir["/Volumes/TempData/Collects/Sasi/android/**"],"/Volumes/Data/Apps/android")
puts "done"
elsif operating_system == "ios" then
FileUtils.cp_r(Dir["Volumes/Data/Apps/iOS/CX5/**"],"/Volumes/TempData/Collects/For_CS")
puts "done"
else
puts "do nothing"
end
非常感謝,有效! – sasi
也適用於我。 – amorphid
Threadnecromancer,@sasi如果它適合你,請接受答案。 – Pred