Create a file in a directory shell -
i have directory named "dir" in there html file , folders named 01 02 03 ... 10. want create folder "dir", in each folder file page01.html folder 01 , page02.html dir 02 etc ..
i have tried:
for in `ls -a * /`; touch page$i.html done
but not create me files in directories.
thank you
to create file pagex.html
each directory x
, can use:
for dir in */ touch "$dir/page$dir.html" done
this safer , less redundant version of for dir in `ls -d */`
, should never used has problems various types of special characters.
if have other directories, can limit ones 2 digits name:
for dir in [0-9][0-9]/ touch "$dir/page$dir.html" done
Comments
Post a Comment