[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] 2 Perl questions ?
- Subject: [ale] 2 Perl questions ?
- From: sriad at uab.edu (Aditya Srinivasan)
- Date: Wed Dec 15 09:42:58 2004
- In-reply-to: <[email protected]>
Hi,
I would recommend writing a shell script for this.
To do this you would need to use the find program, which is the most
commonly used file system traversal utility used with shell scripts.
If you need to take some action based on a file that matches a certain
criteri, use the -exec switch.
Some examples :
http://metric.it.uab.edu/~sriad/notes/linux/find.txt
Here is a script to recursively rename file extensions using find.
http://metric.it.uab.edu/~sriad/notes/linux/rename.txt
Thanks,
sriad
On Wed, 15 Dec 2004, Courtney Thomas wrote:
> Purpose:
>
> write a small program that will process all files in a designated dir, which
> contains files and dirs, by examining each file entry and sums it to a
> total, which is less than some arbitrarily entered size, [in this case
> <=650MB since the purpose is to aggregate chunks of the original dir into
> separate dirs <=650MB for burning to a CD], and if the total <=650MB,
> then, move that entry into the new "burn" dir, and continue until a
> total <=650MB is reached, then stop.
>
> In this way I can take an arbitrary size dir and allocate it to any
> number of burn dirs of <=650MB, then burn 'em.
>
> -------------------------------------------------------------------------
> 2 Problems:
>
> 1-The compiler is complaining about uninitialed variables within a
> "while" loop. How do I properly initialize numeric variables within the
> loop ?
>
> 2-I also need to traverse a dir that itself contains dirs, processing
> each file and dir. How do I traverse such a dir such that....when a dir
> is encountered it is entered and all the files in it are then processed,
> and if necessary drills down through other dirs [howto control depth
> ?]...before returning to the original dir that contained files and dirs ?
>
> --------------------------------------------------------------------------
>
>
> Appreciatively,
> Courtney
>
>
>
>
--
Thanks,
sriad