using "touch" to create directories?

Posted by user66732 on Server Fault See other posts from Server Fault or by user66732
Published on 2011-01-17T09:03:56Z Indexed on 2011/01/17 9:55 UTC
Read the original article Hit count: 204

Filed under:
|

1) in the "A" directory:

find . -type f > a.txt

2) in the "B" directory:
cat a.txt | while read FILENAMES; do touch "$FILENAMES"; done

3)
Result: the 2) "creates the files" [i mean only with the same filename, but with 0 Byte size] ok. But if there are subdirs in the "A" directory, then the 2) can't create the files in the subdir, because there are no directories in it.

Question: is there a way, that "touch" can create directories?

© Server Fault or respective owner

using "touch" to create directories?

Posted by user62367 on Super User See other posts from Super User or by user62367
Published on 2011-01-17T09:03:48Z Indexed on 2011/01/17 9:55 UTC
Read the original article Hit count: 204

Filed under:
|

1) in the "A" directory:

find . -type f > a.txt

2) in the "B" directory:
cat a.txt | while read FILENAMES; do touch "$FILENAMES"; done

3)
Result: the 2) "creates the files" [i mean only with the same filename, but with 0 Byte size] ok. But if there are subdirs in the "A" directory, then the 2) can't create the files in the subdir, because there are no directories in it.

Question: is there a way, that "touch" can create directories?

© Super User or respective owner

Related posts about linux

Related posts about bash