Solved

Batch File to move and copy and compress a file

Posted on 2016-08-12
7
34 Views
Last Modified: 2016-08-12
I just upgraded a pc to windows 10 pro.  The previous pc used a piece of software called pkzip.  my old batch file would call on pkzip.   Is there a way to do this with Windows 10 and the native compression utility.

This is the actual batch file code below that used pkzip.  If anyone could rewrite it with a native compression utility in Windows 10, that would be awesome.  If you can't rewrite it with windows 10.... can you point me to a utility that is free that can provide the same functionality.   This needs to be a very simple process for my user.
0
Comment
Question by:jamesmetcalf74
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 23

Expert Comment

by:NVIT
ID: 41754292
Code?
0
 
LVL 95

Expert Comment

by:Lee W, MVP
ID: 41754293
Check out 7zip - it's free and they have a command line utility you can script (you didn't post any code or files).
0
 
LVL 52

Expert Comment

by:Bill Prew
ID: 41754295
You didn't include a sample of the code.

My recommendation would be to ge the free utility 7-Zip and we can adjust the code to use it once we see your code.  Should be easy.  It's a well supported product and great for command line usage, Windows doesn't really have the same capability from a BAT script.

http://www.7-zip.org/

~bp
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:jamesmetcalf74
ID: 41754324
sorry
cd mail
REM - This batch file compresses the files needed to send
REM - (notice)
c:\MAIL
@echo off
cd \mail
DEL abW.ZIP
CLS
PKZIP abW.ZIP DEL.FSW
ECHO ********************************************************************
ECHO Finished compressing the file - now it will be tested.
ECHO ********************************************************************
PKUNZIP -T abW.ZIP
ECHO ********************************************************************
ECHO ÿ
PAUSE
0
 
LVL 52

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 41754353
Here's a quick try at a conversion to 7zip, give it a test.  Download and install the software, and then point to the EXE in this file.

cd mail
REM - This batch file compresses the files needed to send
REM - (notice)
c:\MAIL
@echo off
set ZipExe=C:\Program Files\7-Zip\7z.exe
cd \mail
DEL abW.ZIP
CLS
"%ZipExe%" a -tzip "abW.ZIP" "DEL.FSW"
ECHO ********************************************************************
ECHO Finished compressing the file - now it will be tested.
ECHO ********************************************************************
"%ZipExe%" t "abW.zip" "DEL.FSW"
ECHO ********************************************************************
ECHO ÿ
PAUSE

Open in new window

~bp
0
 
LVL 23

Expert Comment

by:NVIT
ID: 41754374
For native compression, i.e. without 3rd party tools like 7-zip or pkzip, you can use Powershell:

Compress-Archive -Path 'c:\MAIL\DEL.FSW' -DestinationPath 'c:\MAIL\abW.ZIP'

Open in new window

0
 

Author Closing Comment

by:jamesmetcalf74
ID: 41754451
Sweet man it works!!!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now