A double click on the .bat file for a copy of the data in a dated folder
dobackup.bat
set stamp=%date:~6,4%%date:~3,2%%date:~0,2%_%time:~0,2%%time:~3,2%%time:~6,2%_bak
set source="c:\data"
set target=c:\data_backups\%stamp%
robocopy %source% %target% /XD temp /E > %target%.log
robocopy flags:
/XD - exclude directory (in this case temp files that I don't want to backup)
/E - copy (not mirror)
Not a blog about plumbing, or Super Mario, but in fact a series of posts about technology, IT and a few other things.
Search This Blog
Showing posts with label dos script. Show all posts
Showing posts with label dos script. Show all posts
Tuesday, 2 October 2012
Bulk unzip with windows compression libraries
We had a client send a large number of PDF files split across a number of zip files (old school RAR thinking). Once copied to the server the following scripts can do a batch unzip using the compression libraries built into Windows Server. There's probably a better way to do this with Powershell...
bulkunzip.bat
for %%i in (c:\temp\*.zip) do doUnzip "%%i"
doUnzip.vbs
ZipFile=WScript.Arguments.Item(0)
ExtractTo="c:\temp\unzipped"
set objShell = CreateObject("Shell.Application")
set FilesInZip=objShell.NameSpace(ZipFile).items
objShell.NameSpace(ExtractTo).CopyHere(FilesInZip)
Set fso = Nothing
Set objShell = Nothing
bulkunzip.bat
for %%i in (c:\temp\*.zip) do doUnzip "%%i"
doUnzip.vbs
ZipFile=WScript.Arguments.Item(0)
ExtractTo="c:\temp\unzipped"
set objShell = CreateObject("Shell.Application")
set FilesInZip=objShell.NameSpace(ZipFile).items
objShell.NameSpace(ExtractTo).CopyHere(FilesInZip)
Set fso = Nothing
Set objShell = Nothing
Subscribe to:
Posts (Atom)