|
#1
|
|||
|
|||
|
I had an old batch file that used winzip that I am trying to convert over to use PACL.
What it should do: Pulls all of the listed types of media files from a CD, including all subdirectories and preserving pathnames. Creates a .zip archive of all of them and outputs a log file. The batch file takes 2 arguments: the name of the archive to create and the letter of the CD-Drive that has the CD in it. When I run the Batch file as "makepzip ta0000 e" this is the output from the log: Archive: d:\ta0000.zip preparing to compress... *** WARNING: Nothing to add or update... All OK So, it looks like either it is not going into all the subdirectories on the CD, or it is only checking the first filetype (jpg), because I know that there are .gif files in some of the directories. Here are the commands in my Batch file: @ECHO OFF ECHO ** This batch file will find all Media Files on %2 and create a zip ** ECHO ** file called d:\%1.zip and d:\%1.log ** "c:\apps\PACOMP" -a -r -P d:\%1.zip %2:\*.jpg %2:\*.bmp %2:\*.gif %2:\*.jpeg %2:\*.tif %2:\*.tiff %2:\*.mpg %2:\*.mpeg %2:\*.mov %2:\*.rm %2:\*.ram %2:\*.asf %2:\*.wmv %2:\*.mpe %2:\*.avi %2:\*.jfif %2:\*.jif %2:\*.art %2:\*.jpe %2:\*.png %2:\*.vob %2:\*.3gp %2:\*.mpa %2:\*.tmp %2:\*.3g2 %2:\*.asx %2:\*.flv %2:\*.shs %2:\*.m2v %2:\*.mod %2:\*.cjp %2:\*.divx %2:\*.wm %2:\*.dv %2:\*.mp4 > d:\%1.log Any help you can give me would be greatly appreciated. Thanks! Dustin |
|
#2
|
||||
|
||||
|
Two thoughts - but not much help, I'm afraid.
a) I believe there is a 255 char limit on the command b) It appears that the -r command does not work when a filetype is specified (i.e. works only with *.*) Will have to wait for Spwolf or Milli to confirm / deny. P.S. I did a quick test with PACL 6.01 on XP SP3
__________________
Terry WinXP SP3 |
|
#3
|
|||
|
|||
|
Hmm, didn't think about the character limit, although it does get all the way through the command and create the log file. I am using 6.01 with WinXP SP3 as well.
I guess I could execute a separate command to add each file type to the archive, but I was hoping there was a more efficient way of doing it. |
|
#4
|
|||
|
|||
|
I did some more testing, using multiple instances of the command, can definitely say that it is not recursing the subdirectories. Anyone see a syntax error in the command I'm using?
"c:\apps\PACOMP" -a -r -P d:\%1.zip %2:\*.inf >> d:\%1.log |
|
#5
|
|||
|
|||
|
Guess I should add that passing in the arguments and using them in the commands is working fine. There was a .inf file in the root, and it successfully added it to the archive and sent the log to the file.
|
|
#6
|
||||
|
||||
|
didnt have time yet to look, will do a bit later on, thanks for the patience!
__________________
ConeXware, Inc. latest PA release info on Facebook, Twitter | Follow us and win free PowerArchiver. |
|
#7
|
|||
|
|||
|
Hi spwolf, have you had a chance to look at this issue yet?
Thanks! |
|
#8
|
||||
|
||||
|
i have an feeling recurse subfolder option does not work unless it gets *.*, which is where the problem would be then... i have sent it to dev team to investigate.
__________________
ConeXware, Inc. latest PA release info on Facebook, Twitter | Follow us and win free PowerArchiver. |
|
#9
|
|||
|
|||
|
Hmm, ok, thanks!
|
|
#10
|
||||
|
||||
|
Hi Dustin!
Quote:
The script is this: Code:
'***********************************************************
'* PACOMP.vbs
'* @author: Micke
'*
'* Script for compress multiple file types
'*
'* Usage: cscript PACOMP.vbs ArhiveName.extension DrivePath
'* Example1: cscript PACOMP.vbs MyArchive.zip D:
'* Example2: cscript PACOMP.vbs MyArchive.zip D:\Temp
'*
'***********************************************************
Option Explicit
'Variables
Dim FSO, objDir, aList, FileExtension, ArchiveName, DrivePath
Dim aFile, aItem, strCompressionString, WshShell
'Constants (Change path to your own enviroment)
Const PACOMP = "C:\Programs\PACL\PACOMP.exe"
'Check number of arguments
If WScript.Arguments.Count <> 2 Then
WScript.Echo "Usage: cscript PACOMP.vbs ArchiveName.extension DrivePath"
WScript.Echo "Example 1: cscript PACOMP.vbs MyArchive.zip D:"
WScript.Echo "Example 2: cscript PACOMP.vbs MyArchive.zip D:\Temp"
WScript.Quit
End If
'Create the FileSystemObject
Set FSO = CreateObject("Scripting.FileSystemObject")
'Create the ShellObject
Set WshShell = CreateObject("WScript.Shell")
'Get data from the Arguments
ArchiveName = WScript.Arguments.Item(0)
DrivePath = WScript.Arguments.Item(1)
'Get the Folders for the DrivePath
Set objDir = FSO.GetFolder(DrivePath)
'Create a Array with Fileextensions for the archive, change to your enviroment
aList = Array("png", "jpg", "avi")
'Search through the folders
SearchFolders(objDir)
'Sub for Searching recursive in Folders
Sub SearchFolders(pstrCurrentPath)
For Each aFile In pstrCurrentPath.Files
For Each FileExtension In aList
If FileExtension = LCase(Right(CStr(aFile.Name), 3)) Then
AddFileToArchive aFile.Path
End If
Next
Next
For Each aItem In pstrCurrentPath.SubFolders
SearchFolders(aItem)
Next
End Sub
Sub AddFileToArchive(pstrFileName)
'Create the string with parameters for PACOMP
strCompressionString = PACOMP & " -a -P " & ArchiveName & " " & pstrFileName
WScript.Echo strCompressionString
WshShell.Run strCompressionString, 0, True
End Sub
There are two lines in the script you have to modify for your own enviroment. Change this to your path for PACOMP Code:
Const PACOMP = "C:\Programs\PACL\PACOMP.exe" Code:
aList = Array("png", "jpg", "avi")
Kind Regards Micke |
| The Following User Says Thank You to Micke For This Useful Post: | ||
spwolf (02-26-2010) | ||
|
#11
|
||||
|
||||
|
Micke,
When I tried it - I changed the path to PACOMP and the extension array to (jpg, png, txt). Each "expected" command line was echoed, but no archive file was created ![]() Then I tried full path ( c:\multypes.zip ) for "my archive" but other than that my script understanding is very limited. What did I miss?
__________________
Terry WinXP SP3 |
|
#12
|
||||
|
||||
|
Quote:
Quote:
Kind Regards Micke |
|
#13
|
||||
|
||||
|
Quote:
Try to change the archive name from c:\multypes.zip to c:\temp\multypes.zip Kind Regards Micke |
|
#14
|
||||
|
||||
|
Quote:
Quote:
Quote:
The c:\temp folder is empty. Thanks for getting back so quick. P.S. I am admin on WinXP SP3 P.P.S. Just thought - should the output path/filename to add be in quotes ??
__________________
Terry WinXP SP3 |
| The Following User Says Thank You to TBGBe For This Useful Post: | ||
spwolf (03-01-2010) | ||
|
#15
|
||||
|
||||
|
Hi!
Quote:
, because when I tested the script I didn't have any spaces in the path or in the filename resulting in that everything looked ok.Here's the updated script with support for spaces in path or filename. Code:
'*******************************************************************
'* PACOMP.vbs
'* @author: Micke
'* @hist 2010-02-26 CREATED:Script for compress multiple file types
'* @hist 2010-03-01 BUGFIX: Space in path or filename resulted in
'* no archive was created.
'*
'* Script for compress multiple file types
'*
'* Usage: cscript PACOMP.vbs ArchiveName.extension DrivePath
'* Example1: cscript PACOMP.vbs C:\Temp\MyArchive.zip D:
'* Example2: cscript PACOMP.vbs C:\Temp\MyArchive.zip D:\Temp
'*
'*******************************************************************
Option Explicit
'Variables
Dim FSO, objDir, aList, FileExtension, ArchiveName, DrivePath
Dim aFile, aItem, strCompressionString, WshShell
'Constants (Change path to your own enviroment)
Const PACOMP = "C:\Programs\PACL\PACOMP.exe"
'Check number of arguments
If WScript.Arguments.Count <> 2 Then
WScript.Echo "Usage: cscript PACOMP.vbs ArchiveName.extension DrivePath"
WScript.Echo "Example 1: cscript PACOMP.vbs C:\Temp\MyArchive.zip D:"
WScript.Echo "Example 2: cscript PACOMP.vbs C:\Temp\MyArchive.zip D:\Temp"
WScript.Quit
End If
'Create the FileSystemObject
Set FSO = CreateObject("Scripting.FileSystemObject")
'Create the ShellObject
Set WshShell = CreateObject("WScript.Shell")
'Get data from the Arguments
ArchiveName = WScript.Arguments.Item(0)
DrivePath = WScript.Arguments.Item(1)
'Get the Folders for the DrivePath
Set objDir = FSO.GetFolder(DrivePath)
'Create a Array with Fileextensions for the archive, change to your enviroment
aList = Array("png", "jpg", "avi")
'Search through the folders
SearchFolders(objDir)
'Sub for Searching recursive in Folders
Sub SearchFolders(pstrCurrentPath)
For Each aFile In pstrCurrentPath.Files
For Each FileExtension In aList
If FileExtension = LCase(Right(CStr(aFile.Name), 3)) Then
AddFileToArchive aFile.Path
End If
Next
Next
For Each aItem In pstrCurrentPath.SubFolders
SearchFolders(aItem)
Next
End Sub
Sub AddFileToArchive(pstrFileName)
'Create the string with parameters for PACOMP
strCompressionString = PACOMP & " -a -P " & Chr(34) & ArchiveName & Chr(34) & " " & Chr(34) & pstrFileName & Chr(34)
WScript.Echo strCompressionString
WshShell.Run strCompressionString, 0, True
End Sub
Please let me know the result after you have tested the updated script. Kind Regards Micke |
| The Following User Says Thank You to Micke For This Useful Post: | ||
spwolf (03-01-2010) | ||
|
#16
|
||||
|
||||
|
That's got it.
Well done
__________________
Terry WinXP SP3 |
|
#17
|
||||
|
||||
|
Thanks, nice to hear that it's working for you now.
Kind Regards Micke |
|
#18
|
|||
|
|||
|
Wow, thanks for helping out with that script Micke! I'll give it a try.
Thanks, Dustin |
|
#19
|
||||
|
||||
|
Hi Dustin!
Have you tested the script and if so, is it working correctly for you? Kind Regards Micke |
|
#20
|
|||
|
|||
|
Yes, your script works. Thanks for all the help!
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to unzip file to desirable destination with batch file? | BirgemBorg | Tech Support | 2 | 01-12-2009 11:15 AM |
| compress one file into multiple parts | kpb | Wishlist | 2 | 10-16-2008 09:36 AM |
| File types for extact and archive | smerey | General | 2 | 04-13-2006 07:58 AM |
| Master file types should be backed up! | nameless | Wishlist | 1 | 07-17-2004 10:51 AM |