LinuxQuestions.org
Review your favorite Linux distribution.
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 09-06-2002, 08:34 PM   #1
hemlock
LQ Newbie
 
Registered: Aug 2002
Distribution: RedHat
Posts: 13

Rep: Reputation: 0
Question is there a way to traverse a directory structure & execute a command


Is there a way to traverse a directory structure & execute a command for each directory it enters? Or maybe every file in each directory? The command needs to be a bash script I'd write.

What I'm trying to do is walk (a part of) a directory structure of a filesystem from system A mounted on system B & gzip the files onto another HD on system B, but sleeping between each file so it doesn't load down the network access to system A's files. Nice'ing the job running on system B wouldn't work as there's really nothing running on B most of the time. In fact there's nothing much running on either systems, just serving files.
Perhaps I misunderstand nice (& how servers work) but as I read it, it just lowers priority of that job, and Windows machines accessing the files on A would be unknown/unseen by B as a process that it should be lower than.

I know I can write a bash script that will traverse the directory structure, but I figure someone's already done it & probably better than I could, so why reinvent the wheel.

Last edited by hemlock; 09-06-2002 at 08:39 PM.
 
Old 09-07-2002, 01:22 AM   #2
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 55
Look up http://www.cpan.org , espacially http://search.cpan.org/author/JHI/pe...b/File/Find.pm
also take a look at find (man find), definetely you need find (it has an ability to execute commands on its results), be aware this is a very time consuming task to traverse a directory tree, so you'll need more intellegent AND rules for find, dig it through.
 
  


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
Directory Structure fedix Linux - Newbie 3 10-14-2005 03:48 PM
"WARNING: Circular directory structure" error when deleting directory pistonbrew Linux - Software 5 02-03-2005 07:05 AM
directory structure alaios Linux From Scratch 4 04-20-2004 07:16 PM
understanding directory structure wincrk Linux - General 6 03-02-2003 08:11 AM
directory structure sluggo Linux - Newbie 1 01-20-2002 09:15 PM


All times are GMT -5. The time now is 02:06 AM.

Main Menu
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