LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 01-28-2006, 09:33 PM   #1
ark86
LQ Newbie
 
Registered: Mar 2005
Posts: 4

Rep: Reputation: 0
Recursively traversing sub-directories


What I need to do is recursively traverse some sub-directories, and perform an operation on each file in that subdirectory. More specifically I need to run the specified command on each file and have the output put in the same directory. This is what I have so far:

find . -name *.class -exec jad {} \;

This works fine except that the ouput file that jad generates is put in the directory that I run the command from, whereas I need the output to be in the directory where the corresponding file resides. I would appreciate any help. Thanks in advance.
 
Old 01-29-2006, 01:00 AM   #2
frob23
Senior Member
 
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: Ubuntu, FreeBSD, NetBSD
Posts: 1,449

Rep: Reputation: 47
Try
Code:
find . -name *.class -execdir jad {} \;
Which does the same thing but only after changing to the directory the file is in.
 
Old 01-29-2006, 02:15 PM   #3
ark86
LQ Newbie
 
Registered: Mar 2005
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks, that worked perfect. I have to do it on my mac instead of my gentoo box (different versions of find), but I got it to work.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove directories recursively with same name cboyd Linux - Newbie 5 01-14-2007 10:48 PM
How to Recursively Set Permissions for Directories Only edwin11 Linux - Software 4 12-30-2005 10:54 AM
List all files and recursively open directories. unreal128 Linux - General 2 07-16-2005 03:06 PM
Can ls recursively list only directories? Vosper Linux - General 3 07-16-2005 04:57 AM
tar, excluding directories recursively towlie Linux - Newbie 3 06-17-2004 01:32 PM


All times are GMT -5. The time now is 12:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration