Batch File Script Issue

Dreamslogic
Dreamslogic used Ask the Experts™
on
All want is I got two files in CSV format, PLUSale and ProductCatalog. I need to compress them and move the files to indiviual directory thats all.

Below script works fine, but it has to ZIP the files with same name as CVS file. Which I am not understanding how to do


set SSIS_FTPFILE_ORG=I:\Information Technology\Retail\Durga\OsPos\Store Files\
set SSIS_FTPFILE_DEST=I:\Information Technology\Retail\Durga\OsPos
set LOGFILE=%SSIS_FTPFILE_DEST%zbatlog%curdate%.txt
"C:\Program Files\7-zip\7z.exe" a "%SSIS_FTPFILE_DEST%\ProductCatalog\ProductCatalog.zip" "%SSIS_FTPFILE_ORG%\ProductCatalog.csv" >>"%LOGFILE%"
"C:\Program Files\7-zip\7z.exe" a "%SSIS_FTPFILE_DEST%\PluSales\PluSales.zip" "%SSIS_FTPFILE_ORG%\PluSales.csv" >>"%LOGFILE%"

Any help please.

Thanks,



Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
The 'a' command for 7-zip is simply archiving the files under the name specified ("%SSIS_FTPFILE_DEST%\PluSales\PluSales.zip"). Do you want the name of the archive to be created differently? You should be able to change it in the script to whatever you like.

Syntax of the statement:
Program path = "C:\Program Files\7-zip\7z.exe"
archive command= a
archive file name = "%SSIS_FTPFILE_DEST%\PluSales\PluSales.zip"
source file name = "%SSIS_FTPFILE_ORG%\PluSales.csv"
output to command = >>
log file name = "%LOGFILE%"

Author

Commented:
Hi there,

Thanks once again.

Issue is my PLUSales files are inside the StoreFiles(Directory).  I agree with above statement.  I think Productcatalog is working fine but PLUSale need some changes

FileSystem Struture:
 
StoreFiles(Directory) --> ProdcutCatalog.csv
StoreFiles(Directory) --> PLUSales(Folder1) --> PLUSales1.csv
StoreFiles(Directory) --> PLUSales(Folder2) --> PLUSales3.csv
StoreFiles(Directory) --> PLUSales(Folder2) --> PLUSales4.csv

Solution Required:

OsPos(Directory) --> PLUSales (With all Zipped files in this folder)


Script:
 
set SSIS_FTPFILE_ORG=I:\Information Technology\Retail\Durga\OsPos\Store Files\
set SSIS_FTPFILE_DEST=I:\Information Technology\Retail\Durga\OsPos
set LOGFILE=%SSIS_FTPFILE_DEST%zbatlog%curdate%.txt
 
 
"C:\Program Files\7-zip\7z.exe" a "%SSIS_FTPFILE_DEST%\ProductCatalog\ProductCatalog.zip" "%SSIS_FTPFILE_ORG%\ProductCatalog*.csv" >>"%LOGFILE%"
"C:\Program Files\7-zip\7z.exe" a "%SSIS_FTPFILE_DEST%\PluSales\PluSales.zip" "%SSIS_FTPFILE_ORG%\PluSales*.csv" >>"%LOGFILE%


Thanks for the help,

D

Author

Commented:
No Comments
Try changing
"C:\Program Files\7-zip\7z.exe" a "%SSIS_FTPFILE_DEST%\PluSales\PluSales.zip" "%SSIS_FTPFILE_ORG%\PluSales*.csv" >>"%LOGFILE%

to:
"C:\Program Files\7-zip\7z.exe" a "%SSIS_FTPFILE_DEST%\PluSales\PluSales.zip" "%SSIS_FTPFILE_ORG%\PluSales*\PluSales*.csv" >>"%LOGFILE%



Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial