John M. Dlugosz has asked for the wisdom of the Perl Monks concerning the following question:

I need a 1-off program that will rename a bunch of files. I name my digital picture files based on the date/time, but I forgot to change the timezone on the camera and I got a bunch that are 13 hours off. This is a perfect one-off script, and I want to write in Perl 6 (and run it!), rather than just doing it with Perl 5 and/or 4NT batch processing.

I've installed Pugs.

The question is, what are the equivilent of functions to read a list of file names from the current directory (opendir/readdir, or File::Find module), and what function or object for renaming files?

The pattern part for changing the name I'll figure out from the S\d\d files, but I may still have a question in getting Pugs to actually work in that department.

—John
writing from Beijing

Replies are listed 'Best First'.
Re: [Perl6] Getting Started
by moritz (Cardinal) on Mar 04, 2008 at 13:18 UTC
    Have a look a the ext/ direcotry in the pugs source tree.

    It contains most of the modules that are written for Perl 6 so far, and File-Find is one of them.

    I don't have a pugs install available here, so I can't tell you if they actually work :-/

      mortiz,
      I wrote this test script using the File-Find in pugs/ext to verify that all the examples compiled. When pugs was being actively developed, the spec and the code base were changing so quickly that we constantly had to verify that the existing code continued to work. It has been some time since I have ran the test suite but I suspect someone on #perl6 would have yelled by now if File-Find was not working anymore.

      Cheers - L~R

        With the intentional lack of built-ins, is File-Find the main way to get directory information? Or, is there still a directory-reading primitive to go along with file I/O primitives?

        Next issues is that the Windows Install of Pugs does not include an ext directory. I'm dealing with slow and poor connections from hotels. Is there an easy way I can download these missing parts without repeating what I don't need or the Pugs source?

        —John
        Writing from 西安 (Xi'an), China