[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] (newbie) Getting iterative directory/file structure



This is my first post to the list and I've only been using perl for a
VERY short time -- if this is already out there, only use mild
flame-throwers please.

I'm in the process of writing a routine that will syncronize directory
structures (via ftp) based on any new files placed in a "drop box".
I've already searched through CPAN (and about half a dozen other web/ftp
sites for perl) without seeing any good examples.

Ideally, I'd like to make this cross-platform (Mac/PC) but for
now -- if it works on Mac only, it works good enough.

What I have so far figured out follows:

#!/usr/bin/perl

require Net::FTP; require Mac::MoreFiles; require "GUSI.ph"; require
"StandardFile.pl";

#     for later use when going cross-platform

print ($^O"\n"); print ($]"\n");

#     Have the user select a folder.
#     I'll probably change this to a droplet so this won't be needed.

$prompt = "Please Select a Folder";
$foldername = &StandardFile::GetFolder($prompt,":");

die ("No folder specified") unless ($foldername);

open( OUT, ">prog.dat" );

##################################################################
#    Here's where the problem starts.
#     1. I don't think this will be cross-platform
#     2. It doesn't include an ":" at the end of a directory name as I'm
#        used to and I haven't found a way yet to tell whether it is a
#        file or directory.
##################################################################

Mac::MoreFiles::FSpIterateDirectory("$foldername", 2, sub { print OUT
     @_, "\n"; return 0; }, "");

close( OUT);

#     FTP routines will begin here based on what's in the OUT file
#     above.  I've already figured out this part I think (thanks
#     Charles) but feel free to add whatever you feel might help.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Dennis Little			       mailto://dennis.j.little@lmco.com
Lockheed Martin Missiles & Space       mailto://metnet@worldnet.att.net
Sunnyvale, CA			       Web: http://www.lmms.lmco.com/
Phone: 408/756-2170		       LMMS: O/EA52 B/076 C/3E8
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch