Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Can someone write me a simple Perl script for a few bucks?

Reply
Thread Tools

Can someone write me a simple Perl script for a few bucks?

 
 
mikeand1@comcast.net
Guest
Posts: n/a
 
      02-04-2006
Can someone out there write me a little Perl script? It'd be a dead
simple program, and I can pay you for your time and trouble.

Basically all it has to do is look at the contents of a directory, and
output a text file whose exact contents would depend on the names and
numbers of files in that directory. Bonus points if it can do this for
multiple subdirectories in a directory. I'll give you the specs for the
file if you want to see it before taking on the job.

This would be done on a Windows PC (I'd be working from DOS I suppose.)


Anyone? This would probably take 10 minutes for a decent programmer to
write, I suppose, but I'll pay $50, or whatever it's worth to you,
within reasonable limits depending on how hard it is to do.

Thanks,
Mike

 
Reply With Quote
 
 
 
 
usenet@DavidFilmer.com
Guest
Posts: n/a
 
      02-04-2006
(E-Mail Removed) wrote:
> Can someone out there write me a little Perl script? It'd be a dead
> simple program, and I can pay you for your time and trouble.


http://jobs.perl.org is that way ->

This is a place where free advice is offered to people who are trying
to learn or use Perl.

--
http://DavidFilmer.com

 
Reply With Quote
 
 
 
 
Jürgen Exner
Guest
Posts: n/a
 
      02-04-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Can someone out there write me a little Perl script? It'd be a dead
> simple program, and I can pay you for your time and trouble.
>
> Basically all it has to do is look at the contents of a directory,


perldoc -f opendir
perldoc -f readdir

> and
> output a text file


> perldoc -f open


> whose exact contents would depend on the names and
> numbers of files in that directory.


perldoc -f print

> Bonus points if it can do this for
> multiple subdirectories in a directory. I'll give you the specs for


perldoc -f File::Find

jue


 
Reply With Quote
 
mikeand1@comcast.net
Guest
Posts: n/a
 
      02-04-2006
It's a little more complicated than that:

You can assume the directory is called DirectoryName, and contains
files of only two types: .txt files, and .tif files. The directory
will contain files something like this:

FileName1.txt
FileName1.tif

FileName2.txt
FileName2.tif
FileName3.tif
FileName4.tif

FileName5.txt
FileName5.tif
FileName6.tif
FileName7.tif
FileName8.tif

There is always a .txt file associated with one or more .tif files.

For example, FileName1.txt is obviously associated with FileName1.tif.


But there are three .tif files associated with FileName2.txt:
FileName2.tif, FileName3.tif, and FileName4.tif.

And there are four .tif files associated with FileName5.txt:
FileName5.tif, FileName6.tif, FileName7.tif, and FileName8.tif

The name of a .txt file always corresponds exactly to the name of the
first .tif file associated with it (excepting for the file extension,
of course).

There can be any number of .tif files associated with a .txt file. You
can assume the .tif files associated with a .txt file are always
numbered in sequence, starting with the number of the .txt file.

However, you should assume that the number of .tif files associated
with a .txt file increases with the number of .txt files, as in my
example. The first .txt file might have five .tif files with it, the
second .txt file might have only one .tif file associated with it, and
so on.

The outputted text file should have the following format for the above
group of files:

@FULLTEXT DOC

; Record 1
@C BEGDOC# FileName1
@C ENDDOC# FileName1
@C PGCount 1
@T FileName1
@D @I\DirectoryName\
FileName1.tif

; Record 2
@C BEGDOC# FileName2
@C ENDDOC# FileName4
@C PGCount 3
@T FileName2
@D @I\DirectoryName\
FileName2.tif
FileName3.tif
FileName4.tif

; Record 3
@C BEGDOC# FileName5
@C ENDDOC# FileName8
@C PGCount 4
@T FileName5
@D @I\DirectoryName\
FileName5.tif
FileName6.tif
FileName7.tif
FileName8.tif

You can see that after BEGDOC#, you put the file name corresponding to
the first .tif file that corresponds to a .txt file, and after ENDDOC#,
you put the name of the last .tif file corresponding to that .txt file.
After PGCount, you put the number of .tif files that correspond to
that .txt file. After @T, you put the name of the .txt file (minus the
extension). And then below the @D file, you list all the .tif files
that correspond to that .txt file.

There can be any number of .txt files, sometimes quite large, and any
(nonzero) number of .tif files associated with each .txt file.

The outputted text file should be called DirectoryName.dii where
DirectoryName is the name of the directory holding the files, as above.

That's it.

I have a large number of directories to process in this manner, so if
you want to build a script that automatically searches for
subdirectories containing files like this, and creates a .dii file for
each such subdirectory, that'd be even better.

 
Reply With Quote
 
mikeand1@comcast.net
Guest
Posts: n/a
 
      02-04-2006
OK, I posted it there too.

Thanks,
Mike

 
Reply With Quote
 
Xicheng
Guest
Posts: n/a
 
      02-04-2006
(E-Mail Removed) wrote:
> It's a little more complicated than that:
>
> You can assume the directory is called DirectoryName, and contains
> files of only two types: .txt files, and .tif files. The directory
> will contain files something like this:
>
> FileName1.txt
> FileName1.tif
>
> FileName2.txt
> FileName2.tif
> FileName3.tif
> FileName4.tif
>
> FileName5.txt
> FileName5.tif
> FileName6.tif
> FileName7.tif
> FileName8.tif
>
> There is always a .txt file associated with one or more .tif files.
>
> For example, FileName1.txt is obviously associated with FileName1.tif.
>
>
> But there are three .tif files associated with FileName2.txt:
> FileName2.tif, FileName3.tif, and FileName4.tif.
>
> And there are four .tif files associated with FileName5.txt:
> FileName5.tif, FileName6.tif, FileName7.tif, and FileName8.tif
>
> The name of a .txt file always corresponds exactly to the name of the
> first .tif file associated with it (excepting for the file extension,
> of course).
>
> There can be any number of .tif files associated with a .txt file. You
> can assume the .tif files associated with a .txt file are always
> numbered in sequence, starting with the number of the .txt file.
>
> However, you should assume that the number of .tif files associated
> with a .txt file increases with the number of .txt files, as in my
> example. The first .txt file might have five .tif files with it, the
> second .txt file might have only one .tif file associated with it, and
> so on.
>
> The outputted text file should have the following format for the above
> group of files:
>
> @FULLTEXT DOC
>
> ; Record 1
> @C BEGDOC# FileName1
> @C ENDDOC# FileName1
> @C PGCount 1
> @T FileName1
> @D @I\DirectoryName\
> FileName1.tif
>
> ; Record 2
> @C BEGDOC# FileName2
> @C ENDDOC# FileName4
> @C PGCount 3
> @T FileName2
> @D @I\DirectoryName\
> FileName2.tif
> FileName3.tif
> FileName4.tif
>
> ; Record 3
> @C BEGDOC# FileName5
> @C ENDDOC# FileName8
> @C PGCount 4
> @T FileName5
> @D @I\DirectoryName\
> FileName5.tif
> FileName6.tif
> FileName7.tif
> FileName8.tif
>
> You can see that after BEGDOC#, you put the file name corresponding to
> the first .tif file that corresponds to a .txt file, and after ENDDOC#,
> you put the name of the last .tif file corresponding to that .txt file.
> After PGCount, you put the number of .tif files that correspond to
> that .txt file. After @T, you put the name of the .txt file (minus the
> extension). And then below the @D file, you list all the .tif files
> that correspond to that .txt file.
>

#!/usr/bin/perl
use warnings;
use strict;
use Data:umper;

my $dirname = "My_dir";
local $/='';
my $record;
print "\@FULLTEXT DOC\n";
while(<DATA>) {
my @a=();
print "; Record $.\n";
push @a,$1 while/^(.+?\.tif)$/mg;
$a[0]=~/^(\w+?)\.tif$/ and print "\@C BEGDOC# $1\n";
$a[$#a]=~/^(\w+?)\.tif$/ and print "\@C ENDDOC# $1\n";
print "\@C PGCount ",scalar@a,"\n";
/^(\w+)\.txt$/m and print "\@T $1\n";
print "\@D \@T $dirname\n";
print "$_\n" for@a ;
print "\n";
}
__DATA__
FileName1.txt
FileName1.tif

FileName2.txt
FileName2.tif
FileName3.tif
FileName4.tif

FileName5.txt
FileName5.tif
FileName6.tif
FileName7.tif

========
you can use GNU "find" to traverse your dir and subdir, and use perl to
group filenames into the above form.. you may add dirname to each
group, just use the similar ways to add into the code...
Good luck,

Xicheng

> There can be any number of .txt files, sometimes quite large, and any
> (nonzero) number of .tif files associated with each .txt file.
>
> The outputted text file should be called DirectoryName.dii where
> DirectoryName is the name of the directory holding the files, as above.
>
> That's it.
>
> I have a large number of directories to process in this manner, so if
> you want to build a script that automatically searches for
> subdirectories containing files like this, and creates a .dii file for
> each such subdirectory, that'd be even better.


 
Reply With Quote
 
mikeand1@comcast.net
Guest
Posts: n/a
 
      02-04-2006
BTW, anyone who wants to do this and get paid should notify me first,
so I don't get more than one person working on it.

Thanks,
Mike

 
Reply With Quote
 
Keith Keller
Guest
Posts: n/a
 
      02-04-2006
On 2006-02-04, (E-Mail Removed) <(E-Mail Removed)> wrote:

> I have a large number of directories to process in this manner, so if
> you want to build a script

^^^

If you are posting here, *you* are building the script. If you're
posting job offers, you should not be posting here. Posting to
both here and jobs.perl.org is impolite at best.

--keith

--
http://www.velocityreviews.com/forums/(E-Mail Removed)-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom
see X- headers for PGP signature information

 
Reply With Quote
 
mikeand1@comcast.net
Guest
Posts: n/a
 
      02-04-2006
Keith Keller wrote:
> If you are posting here, *you* are building the script. If you're
> posting job offers, you should not be posting here. Posting to
> both here and jobs.perl.org is impolite at best.
>
> --keith



OK - sorry, thought someone would want to make a couple bucks, didn't
know the netiquette.

Now people are responding to me, feel like I should say something back.

 
Reply With Quote
 
mikeand1@comcast.net
Guest
Posts: n/a
 
      02-04-2006
Thanks - but isn't there some way to do this without having to put the
_DATA_ in each perl script file?

Each directory has a different set of files; the filenames I provided
above was only an example. I'm trying to set it up to output these
files automatically, not have to put the filenames in each script.

Also -- how do I modify that script so that it outputs to a text file,
as opposed to spitting out the text? I assume there's something like
C's printf?

Thanks,
Mike

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
can someone help me print a simple XML document using perl inderpaul_s@yahoo.com Perl Misc 4 04-05-2006 04:12 PM
Can someone post code that can read/write cookie collections with keys? Mike Javascript 1 09-08-2004 01:14 PM
email parsing->mysql:: Can someone explain me this perl script? albatroz Perl Misc 1 08-30-2004 11:54 PM
Perl Help - Windows Perl script accessing a Unix perl Script dpackwood Perl 3 09-30-2003 02:56 AM
It's the simple things that drive me crazy... Can someone peek at this short script? Christopher Javascript 0 08-07-2003 08:21 PM



Advertisments