annabarcode.blogg.se

Bvckup from command line
Bvckup from command line







bvckup from command line
  1. #BVCKUP FROM COMMAND LINE ZIP FILE#
  2. #BVCKUP FROM COMMAND LINE UPDATE#
  3. #BVCKUP FROM COMMAND LINE ARCHIVE#

f Location of archive (default \\.\tape0) b # Use # 512-byte records per I/O block

#BVCKUP FROM COMMAND LINE UPDATE#

c Create -r Add/Replace -t List -u Update -x Extract In the end, the undocumented "-a" option suggested by is required to create ZIP compatible files. This is on Windows Server 2019 Datacenter. While (targetFolderObj.ParseName(item.Name) is nothing) ' (starting multiple asynchronous copy will not work as it causes error messages, an invalid ZIP file. ' this is needed because CopyHere() returns immediately after starting an asynchronous copy process ' wait until the file appears in the ZIP file,

bvckup from command line

' folder is empty, skip it as empty folders can't be compressed

#BVCKUP FROM COMMAND LINE ZIP FILE#

' ZIP file is included in Items collection and is recognized as folder, thus skip it to avoid script errors Set targetFolderObj = app.NameSpace(target) Set sourceFolderObj = app.NameSpace(source) Set app = CreateObject("Shell.Application") ' write ZIP header, this ensures that Windows recognizes the file as "ZIP Folder" Set zip = fso.OpenTextFile(target, 2, vbtrue) Set fso = CreateObject("Scripting.FileSystemObject") ' remove trailing slashes as we add slashes when needed later It's a timing issue as the newly created ZIP file is included in the Items collection when the script is executed on fast machines. Here is an updated version which fixes the "Object required" error reported by pihentagy. My wait loop is based on an answer to a similar issue posted here. One of these issues is that the method returns immediately while the copy process starts in background whereas multiple CopyHere() calls will interfere each other and the ZIP won't be created correctly. Using the CopyHere() method in VBS introduces several issues. I will post something related to WSkids answer as sadly i cannot use the comment function. ' delay until at least items at the top level are availableĭo Until objApp.NameSpace( target ).Items.Count + intSkipped = intSrcItems IntSrcItems = objApp.NameSpace( source ).Items.Count ObjApp.NameSpace( target ).CopyHere objItem ' if this folder is empty, then skip it as it can't compress empty folders Set objFolder = objFSO.GetFolder( objItem.Path )

bvckup from command line

' Loop over items within folder and use CopyHere to put them into the zip folderįor Each objItem in objApp.NameSpace( source ).Items Set objApp = CreateObject( "Shell.Application" ) ' this is the header to designate a file as a zip Set zip = objFSO.OpenTextFile(target, 2, vbtrue) Set objFSO = CreateObject("Scripting.FileSystemObject") Here is the vbs code - Set Args = Wscript.Arguments It won't copy empty folders so be careful. Path to script, source folder, zip file to make (include. Usage: in the run box or command line put- "C:\zipper.vbs" "C:\folderToZip\" "C:\mynewzip.zip" The script was originally made for Windows XP, but it also works in Windows 7 圆4 Ultimate - no guarantee's if Windows will keep around the various Shell objects this uses. Copy and paste the script into a file with the extension ".vbs". I've combined this script from several different sources to suit my needs better.









Bvckup from command line