Perl Script to add a file to a .zip and then delete

JohnnyMCE

Member
Apr 13, 2006
141
0
0
I have been trying and can't get things to work as a whole. I will give you the scenario and what I am trying to do.

For example. Currently every night a uniquely named txt file is getting dropped onto my main C:\ drive. I want to create a script I can schedule to run each morning that will look for that file and then add it to a .zip file elsewhere and then delete the original text file. This is all on a windows machine.

Right now I have been trying to do this just with static names and have been unable to get the syntax to work out properly.
 

esun

Platinum Member
Nov 12, 2001
2,214
0
0
Post your code. Otherwise we can't debug it without writing the whole thing for you.
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,565
4,480
75
Also, what are you using to add a file to a zip? 7-zip?

I'm thinking of a batch file:
Code:
7z a archive.zip *.txt && del *.txt
 

Daverino

Platinum Member
Mar 15, 2007
2,004
1
0
The zipping seems best done with system commands.

-e $file && system ("gzip $file") && unlink $file;

Replace gzip with your favorite zipping program.
 

Cogman

Lifer
Sep 19, 2000
10,284
138
106
The zipping seems best done with system commands.

-e $file && system ("gzip $file") && unlink $file;

Replace gzip with your favorite zipping program.

'cept he is using windows. The windows browser natively supports opening zip archives, it would be somewhat surprising to me if you can't update them... Oh well.