Sign in to follow this  
Followers 0
jun1or

Automating file movement

7 posts in this topic

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

Share this post


Link to post
Share on other sites



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]

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

i would use the following command:

"pgp -p test.xls.pgp"

Thanks

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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)
Next
You 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]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0