Alpha Video Training
Results 1 to 19 of 19

Thread: Ziping of Subfolders

  1. #1
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    379

    Default Ziping of Subfolders

    I was reading some posts has anyone figured out how to zip a folder including all subfolders without using a file list to add each folder seperately.

  2. #2
    Member
    Real Name
    robert muzik
    Join Date
    Nov 2007
    Posts
    406

    Default Re: Ziping of Subfolders

    I use j-zip. To zip a folder and all it's subfolders, I just select the parent folder, right click and select send to. Then I select compressed (zipped) folder. j-zip creates the new zip file on the same drive.

  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: Ziping of Subfolders

    Steve,

    It's not that hard to build the file list on the fly with

    filefind.get_recurse()

    Let us know if you need help with that.
    There can be only one.

  4. #4
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    379

    Default Re: Ziping of Subfolders

    I'm trying to get a command line version of 7zip to run but keep getting out of memory errors. Might try building the file list on the fly,

  5. #5
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    379

    Default Re: Ziping of Subfolders

    for some reason i keep getting out of memory errors using sys_shell() command. here is the script
    Code:
    if file.exists("C:\WINDOWS\system32\cmd.exe") then 
    	sys_shell("C:\WINDOWS\system32\cmd.exe 7za a sgbackup.zip"f1,1)
    else
    	ui_msg_box("Error Opening Program","File 'C:\WINDOWS\system32\cmd.exe' does not exist.",ui_stop_symbol)
    end if
    I have plenty of memory not sure what would cause this to act up.
    f1 is a variable set with the foldername i want to zip.

  6. #6
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    379

    Default Re: Ziping of Subfolders

    I found where i'm going wrong
    it's sys_shell("7za a sgbackup.zip+f1",1) where i try to add the f1 variable f1 is the path should read with the var added sgbackup.zip c:\testfolder\*
    Last edited by steve745; 04-26-2009 at 08:28 PM.

  7. #7
    Member
    Real Name
    robert muzik
    Join Date
    Nov 2007
    Posts
    406

    Default Re: Ziping of Subfolders

    I didn't realize you were trying to do this from a command line. glad you figured it out.

  8. #8
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    379

    Default Re: Ziping of Subfolders

    OH but I haven't totally figured this out yet.

  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: Ziping of Subfolders

    Maybe this is what you want....

    Code:
    f1 = "c:\testfolder\\"
    ? f1
    = "c:\testfolder\"
    
    zipspec = "7za a sgbackup.zip "+f1
    ? zipspec
    = "7za a sgbackup.zip c:\testfolder\"
    
    sys_shell("7za a sgbackup.zip "+f1,1)
    There can be only one.

  10. #10
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    379

    Default Re: Ziping of Subfolders

    well it certainly gives me other ways of putting things into xbasic
    i will play with this a little later

  11. #11
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    379

    Default Re: Ziping of Subfolders

    how can i get the results of f1 to wrap in "" f1="c:\my documents\"

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

    Default Re: Ziping of Subfolders

    how can i get the results of f1 to wrap in "" f1="c:\my documents\"
    Oddly enough, to wrap a string in quote marks, you use the quote() function.

    What does a working command line expression look like?
    There can be only one.

  13. #13
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    379

    Default Re: Ziping of Subfolders

    ok here is what i came up with that works
    sys_shell("7za a c:\ziptest\sgbackup.zip " +quote(f1),1)

    f1 is the value of my folder to backup with the * switch for 7zip
    the wrapping of quotes quote() tells 7zip it's a directory with spaces and to get path exactly as quoted.
    This script combined with 7zip has achieved everything i had hoped.\
    Thanks for all the help stan.

  14. #14
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    379

    Default Re: Ziping of Subfolders

    Now is there a way that after the cmd.exe completes

    x_basic_wait_for_idle function doesn't do it. I need to pause till the zip is complete.

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

    Default Re: Ziping of Subfolders

    Change to

    SYS_SHELL_WAIT("7za a c:\ziptest\sgbackup.zip " +quote(f1),1)
    There can be only one.

  16. #16
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    379

    Default Re: Ziping of Subfolders

    You Rock Thx stan

  17. #17
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    379

    Default Re: Ziping of Subfolders

    Stan is there some form of function to wait if windows command is open. sys_shell_wait() makes each line wait I am just trying to make the next step run after windows command has finished running all the zip scripts. wait_for_idle would be great, but it fires when a5 is idle and the command prompt is still running.

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

    Default Re: Ziping of Subfolders

    sys_shell_wait() makes each line wait
    Not understood. Are you issuing multiple zip commands with sys_shell_wait()? Maybe sys_shell() all except the last in the series, then use sys_shell_wait().
    There can be only one.

  19. #19
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    379

    Default Re: Ziping of Subfolders

    ok yes i'm running multiple threads at the same time i think I can make this work using some if commands thanks stan i'll try putting the if statments in and see where that will take me.

Similar Threads

  1. using autoincrement for subfolders
    By katz3 in forum Alpha Five Version 8
    Replies: 3
    Last Post: 03-03-2009, 02:09 AM
  2. Web Security and Subfolders
    By Nathan Zeiset in forum Application Server Version 8
    Replies: 9
    Last Post: 06-02-2008, 02:03 PM
  3. Web components in subfolders
    By Nathan Zeiset in forum Application Server Version 8
    Replies: 2
    Last Post: 08-03-2007, 11:00 AM
  4. Runtime and Subfolders
    By Sandy Garrett in forum Alpha Five Version 6
    Replies: 0
    Last Post: 07-04-2005, 12:45 PM
  5. Subfolders and Network Optimize
    By mark buonagurio in forum Alpha Five Version 5
    Replies: 4
    Last Post: 04-08-2004, 05:46 AM

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
  •