![](/img/trans.png)
[英]I want to delete all the files under a directory using shell script, passing file directory as an argument
[英]Deleting all the files under a directory using shell script, passing file directory as an argument but do not want to delete the folder itself
示例命令:
./delete.sh /path/to
|-Path
|- to
|- file1
|- file2
|-location
|- file3
|- file4
|- file5
.
.
|- fileN
需要使用脚本删除到和位置目录中的所有文件(文件1,文件2,文件3.....文件N),但不想删除到和位置目录,只需要删除该目录中的文件。
在delete.sh
中,您应该删除目录中的文件
d="$1"
rm -rf $d/*
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.