Subject: Re: Simple Script for Linux or OS X
From: Chad Cunningham (ccunning@math.ohio-state.edu)
Date: Wed May 02 2001 - 22:12:43 EDT
Just one level deep? find is your friend. find is your friend
find /some/dir ! -name ".*" -maxdepth 2 -type f -exec rm -f {} \;
This will delete all regular files 1 directory deep in /some/dir as long
as they don't begin with . (presumably, I would test it first :)
Depending on what you want to do, find can probably do it, see man find
for more options.
On Wed, 2 May 2001, Heath Henderson wrote:
> Hello all, I am in need of a simple Perl script (I am going to attempt it I
> think)
>
> That cleans our users Home directories out, but leaves the Directory itself
> intact and untouched. I want to run this script at the Home directory level
> and have it go 1 level deep and clean out the contents to start fresh next
> school year. It would be nice as well if it was at all possible to set it
> so that the script only looks at accounts that start with a number (It would
> leave our teacher's accounts untouched).
>
> If anyone has any ideas, let me know. I am learning PERL, and thought
> someone may have already needed this in the past, and would know of a place
> to look for some starters.
>
> Thanks
>
> Heath
>
--Chad Cunningham ccunning@math.ohio-state.edu
"Well, once again my friend, we find that science is a two-headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is bad! Oh beware the other head of science, Arthur, it bites!"
This archive was generated by hypermail 2b28 : Sun Oct 14 2001 - 03:04:39 EDT