Means of traversing a directory

2004-06-17 Thread Gerard Samuel
For a shell script.
The scenario.
Im running tar(1) to make a tar ball of a directory using the 
--newer-mtime to only get newer files after a specified date.
Unfortunately, it also creates unwanted empty directories.
Is there a way to scan the directory (recursively) into an array, and loop 
over it, in a script?

Thanks
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Means of traversing a directory

2004-06-17 Thread Richard Caley
In article [EMAIL PROTECTED], Gerard Samuel (gs) writes:

gs Im running tar(1) to make a tar ball of a directory using the 
gs --newer-mtime to only get newer files after a specified date.
gs Unfortunately, it also creates unwanted empty directories.

Have you tried using find? 

If a relative time is good enough

find DIR -type f -mtime -6 

if you need to specify a time and date, I think the only way is to use
touch to makea file at the right date then use find's -newer test.

-- 
Mail me as [EMAIL PROTECTED]_O_
 |

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Means of traversing a directory

2004-06-17 Thread Gerard Samuel
On Thursday 17 June 2004 10:31 am, Richard Caley wrote:
 In article [EMAIL PROTECTED], Gerard Samuel
 (gs) writes:

 gs Im running tar(1) to make a tar ball of a directory using the
 gs --newer-mtime to only get newer files after a specified date.
 gs Unfortunately, it also creates unwanted empty directories.

 Have you tried using find?

 If a relative time is good enough

 find DIR -type f -mtime -6

 if you need to specify a time and date, I think the only way is to use
 touch to makea file at the right date then use find's -newer test.

Well I made an ugly script, (50 lines), but it works.
Ill have to investigate on simplifying it, along with implementing absolute 
time with find, as that would eliminate me from using tar to get the newest 
files.
But the find commands that I used were -

# Blatantly remove CVS directories
find -d ./ -type d -regex '.*/CVS' -exec rm -rf {} \;

# Remove empty directories
find -d ./ -type d -exec rmdir {} \;

So Im good for now.
Thanks
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]