|No such thing as a small change|
Adding/Committing Files to CVSby bassplayer (Monsignor)
|on Sep 12, 2002 at 22:21 UTC||Need Help??|
bassplayer has asked for the
wisdom of the Perl Monks concerning the following question:
Greetings Exalted Monks,
I have been tasked with adding a huge amount of files to CVS. This large web directory was created by others who did not employ CVS (as they should have). I started adding a few files, before realizing what a tremendous amount of time was involved. Then I decided to write some Perl to make my life easier.
Basically, I now have a program that I run in the main directory, and it is supposed to find all acceptible files (.pl, .cgi, .htm, .html, .shtml) and then add and commit them to the repository. It also adds and commits images using the binary setting of CVS. If it finds a directory, it should recurse through it and add and commit files found inside this directory, etc.
I initially found that within directories, the files were not being added or committed, because CVS was being passed file names without full path names. I am using IO::Dir to get directory information. It is not giving me full path names, just file names.
I am storing the directory names in an array, then adding and committing later because I was getting a Deep recursion on subroutine warning.
I apologize for the crappy code, but I wanted to get it working before I later optimized it (and I'm no Perl genius anyway).
I guess my question is, can I even do this the way that I have set out (IO::Dir, Shell)? Is there another way that someone can suggest? Does CVS offer any automation like this?
This should be a simple bit of code, I know, and I'm embarrassed to post this, but at least I'll learn. Anyway, here's the code:
Your help is, of course, very much appreciated. Optimization suggestions are also welcome, as I do not get code review from anywhere, and am very interested in improving my Perl.