I am using zsh and I want to delete contents of a folder without deleting the folder itself. What is the best way to go about this?

有帮助吗?

解决方案

rm -r myfolder/* will delete all files in that folder that do not begin with a dot.

Really the simplest solution is rm -rf myfolder && mkdir myfolder.

其他提示

You can just use rm -r path/to/dir/*.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top