开发者

Recursivly add new files in subfolders

开发者 https://www.devze.com 2023-04-11 22:59 出处:网络
I want to add recursivly new file. This is folder structure \"a/b/c/d/e\". When i use this find . -exec touch file$RANDOM {} \\;

I want to add recursivly new file. This is folder structure "a/b/c/d/e". When i use this

find . -exec touch file$RANDOM {} \; 

I开发者_开发问答 want to get in folder a: file61 and b; in b: file79 and c; etc. But it doesnt work and make only new file in a


find . -type d -exec touch {}/file$RANDOM \;

-type d matches just directories and therefore makes sure find only does the -exec command for directories.

{} (the matched filename) needs to be up front since otherwise the -exec command executes the command from the directory find was run from.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号