The UNIX and Linux Forums
>
Top Forums
>
Shell Programming and Scripting
foreach folder
.
User Name
Remember Me?
Password
google unix.com
Forums
Register
Forum Rules
Links
Albums
FAQ
Members List
Calendar
Search
Today's Posts
Mark Forums Read
Thread
:
foreach folder
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
#
2
(
permalink
)
08-11-2007
blowtorch
Supporter
Join Date: Dec 2004
Location: Singapore
Posts: 2,350
Something like this:
Code:
for file in *; do if [ -d $file ]; then cd $file; mkdir test fi done
-EDIT
You can skip the testing for directory as well. 'cd' won't work on anything except directories (but there might be links that point to directories and you'd end up creating "test" where you don't want to).
blowtorch
View Public Profile
Find all posts by blowtorch
Find blowtorch's past nominations received
Find blowtorch's present nominations given