Uncle Toxie Posted August 31, 2006 Share Posted August 31, 2006 I'm still not sure how this keeps happening to me. My boss (the coder) comes to me (the NOT coder) and asks me to write a program/script to get a few things done. The fact that I am not a programer seems to lost on folks. Anywho, this is what he wants done, if anyone knows how to do this or can point me in a direction so that I can try it, I will praise your name, in this thread. We want to have a folder where we can drop some files, have them encrypted with GPG, FTP'ed to a set location, create a log of the transaction, and then delete the files in that folder. It would seem that he wants the script (or whatever) to scan the folder all the time so as soon as files are dropped in the folder everything kicks in. It doesn't matter what the language is, he just wants it to work. The only experiance I have ever had was a year or so ago in VB6 so I am at a loss. Thanks for any input, I'm headed back to Google......... Quote Link to comment Share on other sites More sharing options...
leetabix Posted August 31, 2006 Share Posted August 31, 2006 Not helpful to you in the sense of solving the dilema in the fashion of creating a program...but you should tell him bluntly, straight, and fairly that you aren't a coder and don't know how to do it. There's nothing he can say/do thereafter. Quote Link to comment Share on other sites More sharing options...
tx Posted August 31, 2006 Share Posted August 31, 2006 Now im no great coder... but the easiest way to do it i should think... from what you just said: Linux box, samba for windows file shareing.. (so you can allow users to place files into there) Then just have a cron job running every say 30 seconds. (maybe checking if the files are still being written too first and deferring the task for another 30 seconds if they are.. so you dont encrypt half a file ;)) Which just, locks the folder. (chmod command) uses the commandline version of GPG to encrypt the folder... use the ftp command to upload it... then the rm command to remove the files and encrypted file you just made, you could even pipe all the information chucked out by those commands into a log file if you wanted. Anyone else got any ideas? Quote Link to comment Share on other sites More sharing options...
wetelectric Posted August 31, 2006 Share Posted August 31, 2006 I'd use perl for ftp its: Net::FTP; my $ftp = Net::FTP->new($host, Debug => 0)       or die "Cannot connect to $host: $@";     $ftp->login("$user","$pass")       or die "Cannot login ", $ftp->message;         $ftp->ascii;     $ftp->cwd("$directory")       or die "Cannot change working directory ", $ftp->message;   foreach my $file ($ftp->ls($pattern))         {           my $doThis=`cd $store_here`;           $ftp->get($file) or warn $ftp->message;         #crappy module cannot store into a sep dir or do mget             my $doThis=`mv -u $file $store_here`;         }     $ftp->quit; ok above is shit. Please for the love of god rewrite it :) and the gpg stuff: use GnuPG qw( :algo );     my $gpg = new GnuPG();     $gpg->encrypt(  plaintext  => "file.txt",  output      => "file.gpg",                     armor      => 1,            sign  => 1,                     passphrase  => $secret );     $gpg->decrypt( ciphertext  => "file.gpg",  output      => "file.txt" );     $gpg->clearsign( plaintext => "file.txt", output => "file.txt.asc",                     passphrase => $secret,  armor => 1,                     );     $gpg->verify( signature => "file.txt.asc", file => "file.txt" );     $gpg->gen_key( name => "Joe Blow",      comment => "My GnuPG key",                   passphrase => $secret,                     ); to create a log just do a redirect of the output to a text file, linkage: GnuPG net::ftp I havnt used gnuPG but i think thunderbird uses it...or maybe im thinking of opengpg ...meh Quote Link to comment Share on other sites More sharing options...
Uncle Toxie Posted August 31, 2006 Author Share Posted August 31, 2006 There's nothing he can say/do thereafter. "Your fired, get your shit and get out." Guess that kinda blows a hole in that theory eh leetabix? :) I was able to find out that we have a pearl script that is doing almost everything that he wants done. The only difference is this script looks for two very specific files and we need it to look for any file. So, since I am unable to just say something and convey my meaning here is what I have that needs changed: my $WorkDir            = '/home/samba/'; my $ArchiveDir        = $WorkDir . 'archive/'; my $SourceDir        = '/home/bostax/'; my @Files            = ( 'tax_proptrust.csv', 'tax_propparcel.csv' ); I am trying to find a way to have the my @Files portion look for a wildcard of some kind that will apply this script to any file in the specified directory. Again, thanks for all the help with this one![/code] Quote Link to comment Share on other sites More sharing options...
Guest Posted August 31, 2006 Share Posted August 31, 2006 There's nothing he can say/do thereafter. "Your fired, get your shit and get out." Guess that kinda blows a hole in that theory eh leetabix? :) Thats when you sue for unfar dismissal. Unless of course you have been hired as a programmer, otherwise he cant actually fire you because you dont have the skills to do something that he wants done. Quote Link to comment Share on other sites More sharing options...
PoyBoy Posted August 31, 2006 Share Posted August 31, 2006 that seems like your only option. its not fair to you if you are forced to do something that you cant and werent hired for. Quote Link to comment Share on other sites More sharing options...
wetelectric Posted September 1, 2006 Share Posted September 1, 2006 There's nothing he can say/do thereafter. "Your fired, get your shit and get out." Guess that kinda blows a hole in that theory eh leetabix? :) I was able to find out that we have a pearl script that is doing almost everything that he wants done. The only difference is this script looks for two very specific files and we need it to look for any file. So, since I am unable to just say something and convey my meaning here is what I have that needs changed: my $WorkDir            = '/home/samba/'; my $ArchiveDir        = $WorkDir . 'archive/'; my $SourceDir        = '/home/bostax/'; my @Files            = ( 'tax_proptrust.csv', 'tax_propparcel.csv' ); I am trying to find a way to have the my @Files portion look for a wildcard of some kind that will apply this script to any file in the specified directory. Again, thanks for all the help with this one![/code] mmm difficult... you try puting a system command (i am assuming unix) in there instead. Somethinglike my @Files            = ( `ls $SourceDir` ); This *should* (heh heh) put the contents of that dir in an array. But this is bad code-fu..because if u have like 1000+ files that means a lotta memory. It is best to skip the @Files. Then use a loop instead. Hope this helps dude. Quote Link to comment Share on other sites More sharing options...
kickarse Posted September 1, 2006 Share Posted September 1, 2006 why not use a program designed to do this type of thing? Quote Link to comment Share on other sites More sharing options...
Uncle Toxie Posted September 1, 2006 Author Share Posted September 1, 2006 Thats when you sue for unfar dismissal. Unless of course you have been hired as a programmer' date=' otherwise he cant actually fire you because you dont have the skills to do something that he wants done.[/quote'] Texas is what they call a right to work state, they can fire me because they don't like the shirt that I am wearing. To be fair, I went back to talk to him after work today and he knows as much about Perl as me. He doesn't expect me to write anything, he just hoped that I could find something we could use. I have a habbit of spending days burried in Google and forums and finding a workable solution to our issues. Bottem line, we need to work on our communication skills in IT department. :D Thanks for the suggestion wetelectirc, I am going to try that. Memory won't really be an issue, the folder is controled by three people and we know exaclty what will be dumped in there. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.