在所有子文件夹创建空文件 [英] Creating empty file in all subfolders

查看:107
本文介绍了在所有子文件夹创建空文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要提取存档,并在每个包含在存档文件夹中创建一个空文件。

I need to extract an archive and create a empty file in each of the folders contained within the archive.

我试过这样:

for folder in `ls -d1 */` ; do touch "${folder}/COMPLETE"; done;

工作只是完美,直到有人在其名称中的空格创建一个文件夹。

works just perfect till someone creates a folder with a space in its name.

我怎么能做到这一点的有或无名称中有空格的所有文件夹?

How can I do this for all folders with or without spaces in their names?

\\雨果

推荐答案

您可以使用,而不是找到:

You can use find instead:

find . -type d -exec touch {}/COMPLETE \;

这篇关于在所有子文件夹创建空文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆