projectz

Tech, Gadgets, Photography, Social Media and Poor Spelling

Question: How can i recursivly search and action on eash file found within a folder structure, and only see the file name?

This is quite a good for/do loop for recursively checking the directory set by $SEARCHDIR and returning only the file name (no path information) for the found files.

for file in $( find $SEARCHDIR -type f -exec basename {} 😉
                do

<enter bash commands here eg. echo $file )

done

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Information

This entry was posted on May 10, 2011 by in regular and tagged , , , , , , .
%d bloggers like this: