我有以下脚本从C:驱动器检索特定的文件类型,并将特定的文件属性输出到分隔的CSV文件.我希望能够检索文件所有者和作者.很感谢任何形式的帮助.
# PowerShell script to list the .xlsx files under the C Drive
$Dir = get-childitem "C:" -recurse -force
$List = $Dir | where {$_.extension -eq ".xlsx"}
$List |Select-Object fullname, LastAccessTime, LastWriteTime, CreationTime |Export-Csv -path C:\Scripts\xlsx.csv -NoTypeInformation
Run Code Online (Sandbox Code Playgroud) TLDR;如何批量格式化我的 JSON 文件以摄取到 Elasticsearch?
我正在尝试将一些 NOAA 数据摄取到 Elasticsearch 中,并且一直在使用 NOAA Python SDK。
我编写了以下 Python 脚本来加载数据并将其存储为 JSON 格式。
from noaa_sdk import noaa
import json
n = noaa.NOAA()
alerts = n.alerts()
f = open('nhc_alerts.json', 'w')
json.dump(alerts, f)
f.write('\n')
Run Code Online (Sandbox Code Playgroud)
JSON 输出:
{"@context": ["https://raw.githubusercontent.com/geojson/geojson-ld/master/contexts/geojson-base.jsonld", {"wx": "https://api.weather.gov/ontology#", "@vocab": "https://api.weather.gov/ontology#"}], "type": "FeatureCollection", "features": [{"id": "https://api.weather.gov/alerts/NWS-IDP-PROD-KEEPALIVE-5246", "type": "Feature", "geometry": null, "properties": {"@id": "https://api.weather.gov/alerts/NWS-IDP-PROD-KEEPALIVE-5246", "@type": "wx:Alert", "id": "NWS-IDP-PROD-KEEPALIVE-5246", "areaDesc": "Montgomery", "geocode": {"UGC": ["MDC031"], "SAME": ["024031"]}, "affectedZones": ["https://api.weather.gov/zones/county/MDC031"], "references": [], "sent": "2020-04-25T19:21:03+00:00", "effective": "2020-04-25T19:21:03+00:00", "onset": null, "expires": "2020-04-25T19:31:03+00:00", …Run Code Online (Sandbox Code Playgroud)