[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
- <!--x-content-type: text/plain -->
- <!--x-date: Wed Dec 15 09:42:58 2004 -->
- <!--x-from-r13: fevnq ng hno.rqh (Oqvgln Eevavinfna) -->
- <!--x-message-id: Pine.LNX.4.44.0412150833120.19702-[email protected] -->
- <!--x-reference: [email protected] --> "http://www.w3.org/TR/html4/loose.dtd">
- <!--x-subject: [ale] 2 Perl questions ? -->
- <li><em>date</em>: Wed Dec 15 09:42:58 2004</li>
- <li><em>from</em>: sriad at uab.edu (Aditya Srinivasan)</li>
- <li><em>in-reply-to</em>: <<a href="msg00529.html">[email protected]</a>></li>
- <li><em>subject</em>: [ale] 2 Perl questions ?</li>
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 :
<a rel="nofollow" href="http://metric.it.uab.edu/~sriad/notes/linux/find.txt">http://metric.it.uab.edu/~sriad/notes/linux/find.txt</a>
Here is a script to recursively rename file extensions using find.
<a rel="nofollow" href="http://metric.it.uab.edu/~sriad/notes/linux/rename.txt">http://metric.it.uab.edu/~sriad/notes/linux/rename.txt</a>
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
</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<ul><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><a name="00533" href="msg00533.html">[ale] 2 Perl questions ?</a></strong>
<ul><li><em>From:</em> joe.sechman at gmail.com (Joe Sechman)</li></ul></li>
</ul></li></ul>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00529" href="msg00529.html">[ale] 2 Perl questions ?</a></strong>
<ul><li><em>From:</em> ccthomas at joimail.com (Courtney Thomas)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00530.html">[ale] 2 Perl questions ?</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00532.html">[ale] ISO image from a mounted CDROM</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00529.html">[ale] 2 Perl questions ?</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00533.html">[ale] 2 Perl questions ?</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00531"><strong>Date</strong></a></li>
<li><a href="threads.html#00531"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>
<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>