Thursday, February 10, 2011

*/ for directories

Want to do something to only the directories but not the files? Just use Bash parameter expansion: */ is "everything whose name ends with a /", eg directories.

For example:
#print all the directories
echo */
#also print all the directories (without -d it recurses)
ls -d */
#zip all the directories in target
zip myoutputfile.zip target/*/
Kinda cool.

2 comments:

farhan said...

thanks Simple but yet interesting and engaging.. Keep up the good work!
my friend's blog
source: www.wbupdates.com

john said...

Great Article android based projects

Java Training in Chennai

Project Center in Chennai

Java Training in Chennai

projects for cse

The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

Post a Comment