Ask Your Question

traverse the directory tree

asked 2014-10-03 09:01:46 -0500

SantoshHoropter gravatar image

updated 2014-10-03 15:13:49 -0500

mether gravatar image

Hi, I need to write a shell script that traverses the directory tree and lists out the directories which have taken different volume on the hard drive than previous hour. It should notify the list of all folders that have had any additions or deletions in terms of memory. I don't know how to traverse the directory tree, can anybody please help me?

edit retag flag offensive close merge delete



What is the purpose of this activity? Perhaps there is a better way.

randomuser gravatar imagerandomuser ( 2014-10-03 16:15:06 -0500 )edit

It is to show/ know about 1. directory traversing 2. volume interpretation (whatever that means)

SantoshHoropter gravatar imageSantoshHoropter ( 2014-10-05 07:42:28 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-10-04 00:08:06 -0500

Jomoos gravatar image

From a stackoverflow answer:

The correct way to recursively traverse a directory is by using the find command:

find . -print0 | while IFS= read -r -d '' file
    echo "$file"
edit flag offensive delete link more



This is the same as simply find .

randomuser gravatar imagerandomuser ( 2014-10-04 12:36:07 -0500 )edit

I guess tree can be used too if all one needs is a list.

FranciscoD_ gravatar imageFranciscoD_ ( 2014-10-05 04:21:40 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-10-03 09:01:46 -0500

Seen: 64 times

Last updated: Oct 04 '14