简体   繁体   中英

How to remove files inside the hadoop directory at once?

I want to remove all the files containes in hadoop directory, without removing the directory itself. I've tried using rm -r but it removed the whole directory.

Please include a wildcard character * after the desired folder you want to delete, to avoid deleting the parent folder. Please look at the example below:

hdfs dfs -rm -r /home/user/folder/*

参考上一个答案,你需要引用星号: hdfs dfs -rm -r "/home/user/folder/*"

Use hdfs command to delete all files in it. For example, if your hadoop path is /user/your_user_name/* then use asterisk to delete all files inside the specific folder.

hdfs dfs -rm -r /user/your_user_name/*

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM