Jump to content

Using Expand.exe


Recommended Posts

Hello, I was hoping that someone would be able to help me out.

I have been trying to automate this procedure.

What it does is that, it goes through all the files in a specific network directory looking for *.RC_ and uses the expand.exe program to decompress to .RCR in the same directory. Then it counts how many files and adds it to the log file. Once this is all completed, it sends me an email telling me how many files etc. I got everything else working but the expand.exe

The problem that I have is that I was unable to get the expand.exe to work with autoit3 I need to work with the dos version of expand, not the universal extractor.

Here is an small portion of the code.

Example file - "\\Mir\Cets\RCERS\1999-00\School327\20061215.RC_"

$FullFilePath = "\\Mir\Cets\RCERS\1999-00\School"
       ;....
       ;....
            If StringInStr($FileAttributes,"D") Then
            ScanFolder($FullFilePath)
        Else
            ToolTip($FullFilePath,0,0,"Project Name - Daily Decompression")
        ;Check if its .RCR or .RC_
            $FilePath = _PathSplit($FullFilePath, $szDrive, $szDir, $szFName, $szExt)
            $RC_FilePath = $FullFilePath 

            If ($szExt = ".RC_") Then
            ;Find out if .RCR exists for the selected .RC_
                $RCRFilePath = StringRegExpReplace($RC_FilePath, ".RC_", ".RCR")
                If Not FileExists($RCRFilePath) Then
                    $test = " /c expand.exe """ & $RC_FilePath & """ """ & $RCRFilePath & """"
                    LogFile($test)
                    Run(@ComSpec & $test) 
                EndIf                   
            EndIf
        EndIf
          ;....

Thanks in advance.

Link to comment
Share on other sites

Hello, I was hoping that someone would be able to help me out.

I have been trying to automate this procedure.

What it does is that, it goes through all the files in a specific network directory looking for *.RC_ and uses the expand.exe program to decompress to .RCR in the same directory. Then it counts how many files and adds it to the log file. Once this is all completed, it sends me an email telling me how many files etc. I got everything else working but the expand.exe

The problem that I have is that I was unable to get the expand.exe to work with autoit3 I need to work with the dos version of expand, not the universal extractor.

Here is an small portion of the code.

Example file - "\\Mir\Cets\RCERS\1999-00\School327\20061215.RC_"

$FullFilePath = "\\Mir\Cets\RCERS\1999-00\School"
      ;....
      ;....
            If StringInStr($FileAttributes,"D") Then
            ScanFolder($FullFilePath)
        Else
            ToolTip($FullFilePath,0,0,"Project Name - Daily Decompression")
    ;Check if its .RCR or .RC_
            $FilePath = _PathSplit($FullFilePath, $szDrive, $szDir, $szFName, $szExt)
            $RC_FilePath = $FullFilePath 

            If ($szExt = ".RC_") Then
        ;Find out if .RCR exists for the selected .RC_
                $RCRFilePath = StringRegExpReplace($RC_FilePath, ".RC_", ".RCR")
                If Not FileExists($RCRFilePath) Then
                    $test = " /c expand.exe """ & $RC_FilePath & """ """ & $RCRFilePath & """"
                    LogFile($test)
                    Run(@ComSpec & $test) 
                EndIf                   
            EndIf
        EndIf
         ;....

Thanks in advance.

You may need the -r switch with your expand.

See

http://www.microsoft.com/technet/prodtechn...k.mspx?mfr=true

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Finally got the darn thing working .

For some reason it didn't like my existing folder path for some reason.

For those who want a working version of it.

#include <Date.au3>
#include <File.au3>
#include <Array.au3>

Dim $MD_FilePath = @ScriptDir & "\DB.MD_"

    ;Find out if .MDB exists for the selected .MD_
        $MDBFilePath = StringRegExpReplace($MD_FilePath, ".MD_", ".MDB")
    If Not FileExists($MDBFilePath) Then
        $Expand = " /c expand.exe """ & $MD_FilePath & """ """ & $MDBFilePath & """"
        Run(@ComSpec & $Expand)
    EndIf

Create your own DB.MDB and use Compress.exe to make DB.MD_

Link to comment
Share on other sites

Finally got the darn thing working .

For some reason it didn't like my existing folder path for some reason.

For those who want a working version of it.

#include <Date.au3>
#include <File.au3>
#include <Array.au3>

Dim $MD_FilePath = @ScriptDir & "\DB.MD_"

;Find out if .MDB exists for the selected .MD_
        $MDBFilePath = StringRegExpReplace($MD_FilePath, ".MD_", ".MDB")
    If Not FileExists($MDBFilePath) Then
        $Expand = " /c expand.exe """ & $MD_FilePath & """ """ & $MDBFilePath & """"
        Run(@ComSpec & $Expand)
    EndIf

Create your own DB.MDB and use Compress.exe to make DB.MD_

I'll try it out in a couple of days.

For your folder path problem try FileGetShortName or enclose the folder path/filename in quotes as in

$Dir = Chr(34) & $Dir & Chr(34)

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...