|
|
|||||||
How can I make sure this script does not use text from the file name as an option in the zip string? :create_zip $cmd=" wzzip -a -ex -rp " $cmd=$cmd+' "$basedir\'+LTRIM(RTRIM($filename))+'.zip" "$basedir\'+LTRIM(RTRIM($filename))+'" ' SHELL '%comspec% /c $cmd ' Thanks Heaps Phoe |
||||||||
|
|
|||||||
Phoenix, Can you please explain in a little more detail what it is your trying to backup. Files? Folders? You use $filename but you don't list/show it in code as to what it is defined as. Here is an example of using the program. Just not sure what you mean or really want. You DON'T want the completed zip file to contain any part of the file zipped? What do you want it named? OR is it that the command is not working at all? If so, maybe this code snipet will help. [ 13. June 2003, 06:06: Message edited by: NTDOC ] |
||||||||
|
|
|||||||
NTDOC, it goes as follows: break on ; $basedir="c:\cli\Clients" $filename=dir("$basedir\*") $archdir="c:\zip\" WHILE ($filename <> "") AND (@error = 0) IF ($filename <> ".") AND ($filename <> "..") AND (GetFileAttr($basedir+"\"+$filename) & 16) GOSUB "create_zip" ENDIF $filename=dir() LOOP EXIT :create_zip $cmd=" wzzip -a -ex -rp " $cmd=$cmd+' "$basedir\'+LTRIM(RTRIM($filename))+'.zip" "$basedir\'+LTRIM(RTRIM($filename))+'" ' SHELL '%comspec% /c $cmd ' It captures the root of each directory and archives everything below with the title of the root directory.zip When it archives, it finds -v in some directory names - wzzip thinks this is an option. Phoe. |
||||||||
|
|
|||||||
Phoenix, Please give this code a try. Make sure WZZIP.EXE is in your path, or use the full path as in my example. NOTE: |
||||||||
|
|
|||||||
WinZip beta 9 http://www.winzip.com/betawz.cgi http://download.winzip.com/cgi-bin/auth/wzbeta90.exe?xfermode=80320448&srcip=24.205.6.96&From=&file=wzbeta90.exe What's new in beta 9 http://www.winzip.com/whatsnew90.htm WinZip Command Line Support Add-On 1.1 Beta Requires WinZip beta 9 http://www.winzip.com/wzclineb.cgi http://download.winzip.com/cgi-bin/auth/wzbetacl.exe?xfermode=58590595&srcip=24.205.6.96&From=&file=wzbetacl.exe |
||||||||
|
|
|||||||
I guess the Phoenix has flown south for the Winter. Perhaps will return Monday |
||||||||
|
|
|||||||
doc, dude... postprepping quotes? you should remember that your quotes most-likely never have correct syntax like we see above... |
||||||||
|
|
|||||||
Yeah, I know, you're right. I manually massaged it to work. Hey, what can I say dude... I love your program too much and try to use it for unintended purposes. |
||||||||
|
|
|||||||
I could make it work for that purpose too if you would just ask me to! |
||||||||
|
|
|||||||
Hey that would be great Lonkero. Would you make it work for that purpose too? PLEASE!!! |
||||||||
|
|
|||||||
NTDOC, I think I've found the problem. Its not the way that the variables are passed to shell. Its wzzip, I just did a cmd line test of it and it failed showing that you can not have -v combined with other options. wzzip -a -ex -rp "c:\files\thisdir.zip" "c:\files\exdir -v exdir\*.*" Well now I have to find another way around. Maybe a rename script. Thanks for your help Phoe |
||||||||
|
|
|||||||
Phoenix, I'm not having any problem creating the zip file on the command line. Here is what I have. KIXTART 4.21 Windows 2000 SP3 IE 6.01 Winzip 9.0 beta Winzip Command-line add-on 1.1 (for Winzip 9 beta) Here is the full commandline used in a DOS Window: (I don't have WZZIP.EXE in path so I use full path) C:\PROGRA~1\WinZip\WZZIP.EXE -a -ex -rp "c:\files\thisdir.zip" "c:\files\exdir -v exdir\*.*" Here is the listing of the files and directories I have. quote:It created a single zip file with all folders. I use the -ee switch because is creates a smaller file then -ex that was the old highest compression switch, now it is -ee I also use -rP (Capital P) to get the full path of directories in the zip file as well. I then modified the KiXtart file to use the new path (not the same path you listed before) and re-ran the code. I got the same error. That is because the quotes were not sufficient to capture all of the information. I modified the command line to this: (you don't need a space and - switch for each option it can be supplied with a single - followed by multiple options. shell 'C:\PROGRA~1\WinZip\WZZIP.EXE -eeorP "$archdir$filename.zip" "$basedir\$filename\*.*"' This now produces the following files in the C:\ZIP folder: - V -ex -v.zip Clients.zip Compaq.zip exdir -v exdir.zip GENSOCK.zip HP.zip Testing -v.zip -v.zip Each zip file contains all the files within its own folder and includes the FULL path. Please retry the code EXACTLY as I've supplied and you should find it now zips up the files as expected. |
||||||||
|
|
|||||||
Phoenix, Did you get a chance to run this? |
||||||||
|
|
|||||||
Phoenix - WHAT'S UP Another flash in the pan? Come on back, the waters fine. Why do we get so many people come by and ask a question, then they either don't check the answer or they get the answer and never come back? KiXtart.org is a GREAT place with a lot of good people. Rod was saying that something like 17,000 people have downloaded Shawn's KiXforms DLL. That is a lot of people, a rather large SILENT Majority so it would seem. |
||||||||
|
|
|||||||
NTDOC, yeah I'm still here working on this. I just haven't been able to get back to it over the last week. You said your script created a single zip file? "It created a single zip file with all folders. " I've just installed winzip9 +cmdline and I'll get back into it now. Thanks for your help Phoe. |
||||||||
|
|
|||||||
NTDOC, Tested the script with winzip 8 +cmdline and wzzip switches Tested the script with winzip 9 beta +cmdline and wzzip switches Winzip 8 reads the line and if it sees -v or - v in the string passed to the command line it will fail. ERROR: option -v, -vi cannot be combined with option -a, -d, -f, -i, -u Program is terminating! Winzip 9 does not have this problem. Perhaps I should test other products for the archive job too. |
||||||||
|
|
|||||||
Phoenix, What OS are you using? I tested this on both Windows 95 and 2000 using WinZip v8.0 originally. Then I upgraded to WinZip 9 beta and it still worked fine. Check your path to make sure you don't have an OLD version of the command line tools somewhere. Also copy the code exactly as above. I have run it many times and I do not get that error anymore. The error was caused by a misuse of quotes "" for the %comspec% call. With the correct usage it works just fine. It creates a zip file for every top folder under the target folder with recursive files in each zip for each folder. |
||||||||
|
|
|||||||
NTDOC, I ran your code posted: posted 16. June 2003 09:36. It functions with winzip9 beta - cmd line but in winzip8 cmd line, it will fail on file names with -v in them. (0004642 Rider-Bell Denise Marilyn -v Carison) This is the code I ran, with the change for the winzip8 cmd line. -------------- break on $basedir="c:\files" $filename=dir("$basedir\*") $archdir="c:\zip\" WHILE ($filename <> "") AND (@error = 0) IF ($filename <> ".") AND ($filename <> "..") AND (GetFileAttr($basedir+"\"+$filename) & 16) shell 'C:\PROGRA~1\WinZip\WZZIP.EXE -a -ex -rp "$archdir$filename.zip" "$basedir\$filename\*.*"' ENDIF $filename=dir() LOOP EXIT 0 ------------ Tested on a WindowsXP WZ8+cmdline I hope I can see it your way, then it may work. Thanks for your patience Phoe. |
||||||||
|
|
|||||||
Okay Phoenix... It was a pain in the butt, but I un-installed WinZip 9 and rebooted. Then I re-installed all Winzip 8.0 and command-line add-on v1.0 I can confirm that 8.0 DOES NOT work. Version 9.0 beta DOES WORK fine. Not sure what you're really trying to do here though. There are plenty of applications and methods for backing up files or systems. Using Winzip for this purpose is okay for a quicky, but not very robust. Why do you need separate zip files for each folder? Why not upgrade to Winzip 9 beta? It is a free upgrade for registered users. Maybe if you give us more details on what the FULL STORY is for the archiving purposes we can either script something better or recommend a better product. In the same/similar category as Winzip, there is WinRaR too. |
||||||||
|
|
|||||||
if you want to compress the files (no need for that either) during the process, you could use windows cab-files and the udf that creates them. they are browseable and extractable via windows explorer or extract.exe (part of windows) or winrar (or any other good packaging util) |
||||||||
|
|
|||||||
Someone slap me for suggesting WinRAR ...or rather, the 32bit commandline version rar.exe included with WinRAR. [ 27. June 2003, 11:11: Message edited by: masken ] |
||||||||
|
|
|||||||
Or even NTBACKUP (comes free with Windows ). You can even create your own backup jobs with KiXtart as the backup job files are plain-text files, than call NTBACKUP via command-line and there you go. |
||||||||
|
|
|||||||
ntbackup is fantastic (use it currently for my most important data-backups) but it needs to access desktop... and it's totally interrubtable by user currently logged on... at least on NT |
||||||||
|
|
|||||||
Have you tried to run it via Task Scheduler under it's own account? Then the current user should not be able to see the GUI. |
||||||||
|
|
|||||||
NTBACKUP would not allow you to accomplish one of the requirements of creating a separate archive for each parent folder. (well, one could I guess, but not very efficiently) Calling Phoenix...!! What is your input to this? What is the reason and FULL requirements? Plenty of knowledgeable people here willing to help you, but we need all the details. [ 30. June 2003, 08:56: Message edited by: NTDOC ] |
||||||||
|
|
|||||||
Yes, it can do that. Create a script that calls NTBACKUP multiple times, and each time one of the parent folder will get backed up. Just rewrite the NTBACKUP backup set file to point to each of the parent folder. |
||||||||
|
|
|||||||
Yeah, that is why I said not very efficient though at least time wise. Hopefully Phoenix will reply with his real requirements. |
||||||||
|
|
|||||||
Using 4NT and Info-ZIP: for /a:D/H %f in ( * ) ( echo %f %+ zip -9 -r -! -D "%f.zip" "%f\*" ) This will create one zip file for each folder in the current one with the same name as the folder using max compression (-9), recursion (-r), NT file attributes (-!), and not storing the "folder" entries (-D). I know this isn't Kix, but NTDOC and others will gladly "KiX" it... The advantage of this Zip is that it is free... |
||||||||
|
|
|||||||
eh. you need the udf: MakeCab() - Create windows cabinet file package with specified files included to use this. code:$full_paths_to_Files ="list of files which you generate" |
||||||||
|
|
|||||||
Correct path to this UDF now that the board has been upgraded. MakeCab() - Create windows cabinet file package with specified files included |
||||||||
|
|
|||||||
Quote: Correct path to this UDF now that the board has been upgraded. MakeCab() - Create windows cabinet file package with specified files included And this upgrade didn't break it this time . |
||||||||
|
|
|||||||
Also check the syntax. compare these two: Code: break on ; $basedir="c:\cli\Clients" $filename=dir("$basedir\*") $archdir="c:\zip\" WHILE ($filename <> "") AND (@error = 0) IF ($filename <> ".") AND ($filename <> "..") AND (GetFileAttr($basedir+"\"+$filename) & 16) GOSUB "create_zip" ENDIF $filename=dir() LOOP EXIT :create_zip $cmd=" wzzip -a -ex -rp " $cmd=$cmd+' "$basedir\'+LTRIM(RTRIM($filename))+'.zip" "$basedir\'+LTRIM(RTRIM($filename))+'" ' SHELL '%comspec% /c $cmd ' Syntax-corrected: Code: break on ; $basedir="c:\cli\Clients" $filename=dir("$basedir\*") $archdir="c:\zip\" WHILE $filename <> "" AND @error = 0 IF $filename <> "." AND $filename <> ".." AND GetFileAttr($basedir+"\"+$filename) & 16 GOSUB "create_zip" ENDIF $filename=dir() LOOP EXIT :create_zip $cmd=" wzzip -a -ex -rp " $cmd=$cmd+' "$basedir\'+LTRIM(RTRIM($filename))+'.zip" "$basedir\'+LTRIM(RTRIM($filename))+'" ' SHELL '%comspec% /c $cmd ' Sidenote: gosub and etc is.. dangerous. I started out with using that as well, but there's better options. |
||||||||
|
|
|||||||
björn, you just removed the brackets? as I can't find any real syntax difference... |
||||||||
|
|
|||||||
Aye, that I did. something tells me that that works as well. haven't seen it before tho. |
||||||||
|
|
|||||||
There is lonkifying and then there is deMCAing. That is classic deMCAing. |
||||||||
|
|
|||||||
http://home.comcast.net/~habullock/habobjects.htm Just use one of the DIR functions to get an array of filenames. Then: Code: ? $Zip2 = $HABObject.Zip() $files = "C:\Data\Scripts\PerlCtrl\objects\Zip.html", "C:\Data\Scripts\PerlCtrl\objects\HABobjects2.DLL", "C:\data\scripts\[censored].kix" for each $file in $files $member = $Zip2.addFile( $file ) if $Zip2.writeToFileNamed( "C:\Data\Scripts\PerlCtrl\objects\Test.zip" ) = 0 ? "Added: " + $file endif next |
||||||||
|
|
|||||||
What nasty stuff you writing that the board censors it Howard? "C:\data\scripts\[censored].kix" ? |