jun1or Posted April 4, 2007 Share Posted April 4, 2007 Hello All I am new to scripting and i want to know if the following is possible: Our client will be uploading PGP encrypted files to an FTP site, i have some vbs code that will automatically move these files to a different location. I am using PGP command line code that will decrypt the file name only, but i want to know if it is possible to script this so that instead looking at the complete file name, it can look at the file extension (.pgp) and when this pgp command runs it picks up all files with this extenstion and decrypts these? Thanks Link to comment Share on other sites More sharing options...
lod3n Posted April 4, 2007 Share Posted April 4, 2007 Perhaps something like this?$targetdir = @DesktopDir #Include <File.au3> $FileList=_FileListToArray($targetdir,"*.pgp") If @Error=1 Then MsgBox (0,"","No Files\Folders Found.") Exit EndIf for $i = 1 to $FileList[0] $fullFilename = $targetdir & "\" & $FileList[$i] $cmd = 'pgp "'& $fullFilename &'"' RunWait($cmd) Next [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
jun1or Posted April 5, 2007 Author Share Posted April 5, 2007 Perhaps something like this?$targetdir = @DesktopDir #Include <File.au3> $FileList=_FileListToArray($targetdir,"*.pgp") If @Error=1 Then MsgBox (0,"","No Files\Folders Found.") Exit EndIf for $i = 1 to $FileList[0] $fullFilename = $targetdir & "\" & $FileList[$i] $cmd = 'pgp "'& $fullFilename &'"' RunWait($cmd) Next It does not like *.pgp throws back an error WARNING: Environmental variable TZ is not defined, so GMT timestamps may be wrong. See the PGP User's Guide to properly define TZ File is encrypted. Link to comment Share on other sites More sharing options...
lod3n Posted April 5, 2007 Share Posted April 5, 2007 What command would you run to decrypt a file named "EncryptedFile.pgp"? [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
jun1or Posted April 11, 2007 Author Share Posted April 11, 2007 i would use the following command: "pgp -p test.xls.pgp" Thanks Link to comment Share on other sites More sharing options...
jun1or Posted April 11, 2007 Author Share Posted April 11, 2007 But the above is a file name i want to use: "pgp -p *.pgp" or any other command that will decrypt several pgp files at once. Link to comment Share on other sites More sharing options...
lod3n Posted April 11, 2007 Share Posted April 11, 2007 Unless PGP allows you to decrypt several files at once, you'll have to do them one at a time, like so:$targetdir = @DesktopDir #Include <File.au3> $FileList=_FileListToArray($targetdir,"*.pgp") If @Error=1 Then MsgBox (0,"","No Files\Folders Found.") Exit EndIf for $i = 1 to $FileList[0] $cmd = 'pgp -p "'& $FileList[$i] &'"' RunWait($cmd,$targetdir) NextYou should only have to change the $targetdir to point to the folder actually containing the encrypted files. [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now