Sign Up   Sign In

Join the community!
Sign in now with your Facebook account.
ForumsTechnicalThread
Forum
Advanced Search
Filter     |   View Watchlist
[ Print Friendly ] [ Watch Thread ]


Windows scripting help [ 1 ]
Rental01
Rental01
#1   Posted 2 years ago
    [ Reply ]   [ Quote ]
I've been hashing away at this for a while now. I need to search a directory every hour for a filename and if it exists, zip it while keeping the existing filename intact minus the file extension. Then another script that I didn't write will grab it and ship it somewhere else.

For instance:
dir *.evt
if (*.evt) exists [compress] (somehow, into .zip format)
delete *.evt

What I've done:
The MS compress tool does a good job and it keeps the filename but I can't control the output.

For instance, if I run "compress fishtank-*.txt -Z -R" on filename "fishtank-2006-12-01-13-01-54-847.txt"it will compress the file in "mszip" format to fishtank-2006-12-01-13-01-54-847.tx_ but I can't rename it to a *.zip or winzip will fail to read it.

Right now I need to find something that will scan a directory (in this case c:\windows\system\config\) for the file, and compress it in the right format.

My brain hurts.
z0dE
z0dE
#2   Posted 2 years ago
    [ Reply ]   [ Quote ]
I think you can run scripts in winrar, and have it output a .zip file. Don't quote me on that though, as I'm at work and don't have my WinRAR on this computer.
Rental01
Rental01
#3   Posted 2 years ago
    [ Reply ]   [ Quote ]
Winzip is our company standard. I can't load winrar on all of the servers without approval and that takes about a month or so.
z0dE
z0dE
#4   Posted 2 years ago
    [ Reply ]   [ Quote ]
Got ya, I'll see what I can dig up for you.
Rental01
Rental01
#5   Posted 2 years ago
    [ Reply ]   [ Quote ]
Sweet. Thanks!
Kull
Kull
Sponsor
#6   Posted 2 years ago
    [ Reply ]   [ Quote ]
In reply to Rental01, #1:

Do you have (or can get) the WinZip command line support add-on? Seems like the way for you to go since you are stuck with WinZip.
Rental01
Rental01
#7   Posted 2 years ago
    [ Reply ]   [ Quote ]
Not sure if we can use it. We have a corporate license for 9 and it's only for winzip standard, not pro. We have 500 servers this will be running on.

I know it can be done with wmi and vb but my book never arrived and my boss took his back when he found out he was getting laid off. :(
racer25x
racer25x
Im ur Daddy
#8   Posted 2 years ago
    [ Reply ]   [ Quote ]
7zip = freeware . . and although I've never used them, I know there are command line extensions for it that should be able to do what I think you want to accomplish here

[edit]

my bad, it's not command line extensions . . . it's a command line version

Post edited 1/05/07 9:45PM
h2freak
h2freak
#9   Posted 2 years ago
    [ Reply ]   [ Quote ]
In reply to Rental01, #1:

I can make a windows application for this. you just need it to search for X file and if found slap a time stamp on it and zip then ship?
Rental01
Rental01
#10   Posted 2 years ago
    [ Reply ]   [ Quote ]
It already has the time/date/random number stamp. Just take the existing 100mb text file ending in ".evt" in the %windir%\System\ (Running Citrix with remapped drives so we have to use this instead of an exact path), zip it to *.zip using the existing filename, then delete the original ".evt" file.

If you could do that it would be awesome! :D
nobody554
nobody554
#11   Posted 2 years ago
    [ Reply ]   [ Quote ]
In reply to Rental01, #1:

I unfortunately lost you here...
For instance, if I run "compress fishtank-*.txt -Z -R" on filename
...seeing as how I don't know scripts, but I know a few people that create scripts quite easily...I'll ask around.
h2freak
h2freak
#12   Posted 2 years ago
    [ Reply ]   [ Quote ]
In reply to Rental01, #10:

you want me to have it place the zip file in the same directory as the source?
Rental01
Rental01
#13   Posted 2 years ago
    [ Reply ]   [ Quote ]
In reply to h2freak, #12:

Yup. If you could set it so that it's command-line configurable as to where it put it (like a unc name or something) that would be cool
Kull
Kull
Sponsor
#14   Posted 2 years ago
    [ Reply ]   [ Quote ]
In reply to Rental01, #10:

Why can't you move/rename the file at compression time? The script compressing the file should already have the generated filename, which should also be able to move the file to wherever you need it.
Rental01
Rental01
#15   Posted 2 years ago
    [ Reply ]   [ Quote ]
Yeah. But if he's creating it I'm just stating requirements. It's up to him to decide how it happens.
[ 1 ]