Alpha Video Training
Results 1 to 13 of 13

Thread: file.unzip...............again

  1. #1
    Member
    Real Name
    Ernie Storms
    Join Date
    Mar 2008
    Location
    Wimberley, Texas
    Posts
    566

    Default file.unzip...............again

    This code doesn't work for me:
    Code:
    	dim filename as c
    	filename = ui_get_file("Select Backup File...","ZipFiles (*.zip)",backup_folder+ chr(92) + data_filename,"X")
    	if filename = "" then
    	    msgbox("Cancelled","Restore Cancelled.")
    	    end
    	end if
    
    	if file.unzip(filename,"*.*",datapath)
    	    msgbox("Success...","Data Files restored successfully.")
    	else
    		msgbox("Unsuccessful...","There was a problem restoring the Data Files.")    
    	end if
    Using debug() I am getting the correct variable values for datapath and filename. It returns a Success message, but the files DO NOT get unzipped.
    This code does work:
    Code:
    unzip_files(filename,"*.*",datapath)
    I would rather use the first one to give the user some sense of what's going on, but it needs to work. Has anybody had any success with the file.unzip() function????
    Ernie

    LATER: Saw a post from 8 years ago (ver.5) about the file.unzip() function not being able to handle filenames with spaces. But not sure which file name, Datapath or Filename???????? It's not anywhere that I can find in the Help files.
    Last edited by enstorms; 01-12-2010 at 09:51 AM.

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: file.unzip...............again

    Your first script works fine here.

    What values are you seeing in the debugger for

    backup_folder
    data_filename
    datapath
    filename

    Runs and works here with

    backup_folder = "C:\azip"
    data_filename = "wo zip.zip" (or data_filename = "wo_zip.zip")
    datapath = "C:\anewzip"
    Last edited by Stan Mathews; 01-12-2010 at 10:05 AM.
    There can be only one.

  3. #3
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: file.unzip...............again

    File.unzip() creates what ever directories it needs to complete so if you are getting a successful message it may be unzipping to a directory that you didn't intend.

    Works here with

    datapath = "C:\anewzip\another dir\and another"

    creating the two sub directories on the fly.
    There can be only one.

  4. #4
    Member
    Real Name
    Ernie Storms
    Join Date
    Mar 2008
    Location
    Wimberley, Texas
    Posts
    566

    Default Re: file.unzip...............again

    Stan,
    Here's what I get in the debugger:

    Datapath -> C:\Alpha5 v9 Projects\HMI
    filename -> C:\Alpha5 v9 Projects\HMI\HMI_Backup_Data\HMI(With GPA - Data Files Only)[118].zip

    Ernie

  5. #5
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: file.unzip...............again

    Seems to work here.

    Unzips C:\Alpha5 v9 Projects\HMI\HMI_Backup_Data\HMI(With GPA - Data Files Only)[118].zip

    to

    C:\Alpha5 V9 Projects\HMI

    My contents won't match yours, of course.
    There can be only one.

  6. #6
    Member
    Real Name
    Ernie Storms
    Join Date
    Mar 2008
    Location
    Wimberley, Texas
    Posts
    566

    Default Re: file.unzip...............again

    Stan,
    Just a thought, but will the file.unzip() function overwrite files already there????
    Ernie

  7. #7
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: file.unzip...............again

    Yes. That would be how a restore backup should work.

    You can check for existing files with FILE.EXISTS() and branch accordingly.
    There can be only one.

  8. #8
    Member
    Real Name
    Ernie Storms
    Join Date
    Mar 2008
    Location
    Wimberley, Texas
    Posts
    566

    Default Re: file.unzip...............again

    Well, it sure doesn't seem to for me. I check the file date before and after and compare to the files in the zip folder. Don't know what's going on.
    Ernie

  9. #9
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: file.unzip...............again

    You should see the date of the restored files as the same date of the files in the zip, not the date the zip was created, right?
    There can be only one.

  10. #10
    Member
    Real Name
    Ernie Storms
    Join Date
    Mar 2008
    Location
    Wimberley, Texas
    Posts
    566

    Default Re: file.unzip...............again

    Yes, that is correct. I've tried deleting a file before doing the restore, but it still doesn't get there. Then I tried the unzip.files() function and it works.?????

  11. #11
    Member
    Real Name
    Ernie Storms
    Join Date
    Mar 2008
    Location
    Wimberley, Texas
    Posts
    566

    Default Re: file.unzip...............again

    Well, just created a one file test app with a form and one button. Copied my xbasic code to the button onpush event and it works just fine. So I guess I'm back to the drawing board. Anybody got any ideas as to what could be the cause?
    Ernie

    PS Well, still had the unzip.files() function in there. Changed back and it still doesn't work. I'll zip up an example and attach.

    PS again Sorry, forgot the instructions. I think all the files needed are there. One button, Restore Data Files. Press and select: Select Location -> Of Data Files Backup
    This should bring up the select file window. The zip file is Data File.zip
    The example app is Restore_test.adb
    Last edited by enstorms; 01-12-2010 at 01:08 PM.

  12. #12
    "Certified" Alphaholic
    Real Name
    Mike Christensen
    Join Date
    Nov 2005
    Location
    Michigan U.P.
    Posts
    5,937

    Default Re: file.unzip...............again

    Ernie,
    It works, but only for files in the root of the zip file you use--it does not "see" any folder and subsequent files...IOW if you had all the files in the root it would choose all the files instead of just the "database" file which is the only file in the zip's root.
    Mike
    __________________________________________
    It is only when we forget all our learning that we begin to know.
    It's not what you look at that matters, it's what you see.
    Henry David Thoreau
    __________________________________________




  13. #13
    Member
    Real Name
    Ernie Storms
    Join Date
    Mar 2008
    Location
    Wimberley, Texas
    Posts
    566

    Default Re: file.unzip...............again

    Mike,
    Thanks for pointing that out to me. Didn't realize the zip file I was testing with was one from the alpha5 tools menu, instead of one I had backed up with the application. Of course, it had the full path in it.
    Thanks again.
    Ernie

Similar Threads

  1. File exists, Choose a different file. Blank Web Apps Control Page
    By AAVasaris in forum Application Server Version 9 - Web/Browser Applications
    Replies: 5
    Last Post: 06-25-2008, 06:06 PM
  2. Code to unzip data files from one location to another
    By bryanstrader in forum Alpha Five Version 7
    Replies: 2
    Last Post: 07-31-2006, 01:16 PM
  3. Unzip file
    By jarty67 in forum Alpha Five Version 6
    Replies: 9
    Last Post: 11-11-2004, 09:36 AM
  4. another unzip problem
    By richarddsmith in forum Alpha Five Version 5
    Replies: 9
    Last Post: 10-19-2002, 07:00 PM
  5. Zip, unzip, backup ....
    By drgarytraub in forum Alpha Five Version 5
    Replies: 6
    Last Post: 09-01-2002, 12:29 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •