我在Ruby / Watir工作 我正在从他们进来的网站下载文件.zip文件夹 我想解压缩那些文件夹,但我不知道下载文件夹的名称,所以我决定使用不工作的通配符
Zip::File.open('my/directory/*.zip') { |zip_file|
zip_file.each { |f|
f_path=File.join("fil_download", f.name)
FileUtils.mkdir_p(File.dirname(f_path))
zip_file.extract(f, f_path) unless File.exist?(f_path)
}
}
答案 0 :(得分:1)
"通配符"实际上是一个名为glob pattern的功能。 Ruby支持Dir.glob()
。
应该是:
var czml = [
{
"id" : "document",
"name" : "CZML Geometries: Polygon",
"version" : "1.0"
}, {
"id" : "orangePolygon",
"name" : "Orange polygon with per-position heights and outline",
"polygon" : {
"positions" : {
"cartographicDegrees" : [
-70.0, 35.0, 100000,
-72.0, 37.0, 0,
-68.0, 35.0, 0
]
},
"material" : {
"solidColor" : {
"color" : {
"rgba" : [255, 100, 0, 100]
}
}
},
"extrudedHeight" : 0,
"perPositionHeight" : true,
"outline" : true,
"outlineColor" : {
"rgba" : [0, 0, 0, 255]
}
}
},
{
"id" : "orangePolygon2",
"name" : "Orange polygon with per-position heights and outline",
"polygon" : {
"positions" : {
"cartographicDegrees" : [
-70.0, 35.0, 100000,
-70.0, 33.0, 0,
-68.0, 35.0, 0
]
},
"material" : {
"solidColor" : {
"color" : {
"rgba" : [255, 100, 0, 100]
}
}
},
"extrudedHeight" : 0,
"perPositionHeight" : true,
"outline" : true,
"outlineColor" : {
"rgba" : [0, 0, 0, 255]
}
}
},
{
"id" : "orangePolygon3",
"name" : "Orange polygon with per-position heights and outline",
"polygon" : {
"positions" : {
"cartographicDegrees" : [
-70.0, 35.0, 100000,
-70.0, 33.0, 0,
-72.0, 37.0, 0,
]
},
"material" : {
"solidColor" : {
"color" : {
"rgba" : [255, 100, 0, 100]
}
}
},
"extrudedHeight" : 0,
"perPositionHeight" : true,
"outline" : true,
"outlineColor" : {
"rgba" : [0, 0, 0, 255]
}
}
}
];
var viewer = new Cesium.Viewer('cesiumContainer');
var dataSource = Cesium.CzmlDataSource.load(czml);
viewer.dataSources.add(dataSource);
viewer.zoomTo(dataSource);