我有一個目錄結構作爲 HDFS如下,如何獲得最終目錄的絕對路徑?
/data/current/population/{p_1,p_2} /data/current/sport /data/current/weather/{w_1,w_2,w_3} /data/current/industry
的文件夾population, sport, weather & industry
各自對應於不同的數據集。如果可用,則結束文件夾(例如p_1
& p_2
)與不同的數據源有關。
我正在處理這些A_1, A_2, B, C_1, C_2, C_3 & D
文件夾(結束文件夾)上的PySpark代碼。給你的代碼一個類似/data/current/
的路徑,你如何提取只有最終文件夾的絕對路徑?
命令hdfs dfs -ls -R /data/current
給出了下面的輸出
/data/current /data/current/population /data/current/population/p_1 /data/current/population/p_2 /data/current/sport /data/current/weather /data/current/weather/w_1 /data/current/weather/w_2 /data/current/weather/w_3 /data/current/industry
但我想最終的文件夾的絕對路徑結束。我的輸出應該像下面
/data/current/population/p_1 /data/current/population/p_2 /data/current/sport /data/current/weather/w_1 /data/current/weather/w_2 /data/current/weather/w_3 /data/current/industry
-Thanks提前