WatchDirectory Forum
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl
watchDirectory forums >> How to... >> It hits, it Zips!
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl?num=1106055403

Message started by adamu on Jan 18th, 2005 at 2:36pm

Title: It hits, it Zips!
Post by adamu on Jan 18th, 2005 at 2:36pm
Hi - just looking to find a solution to a request I have had.

We have an archive drive which contains data in the same structure as the regular drive, however the archive drive is running out of space!

We have found a file type which is common within our company which has a HUGE compression rate, as such zipping them saves lots of room.  

The WatchDirectory solution for command line zipping is perfect with one exception.  The bat file showing this feature sets the location for the zipped files as another set location (e.g. D:\Zipped).  What Iím after though is the file type to be zipped up and left in the same location it was found.  Once zipped the original file will be deleted.

If this makes no sense let me know!

Any help very much appreciated.
Thanks
Adam.

Title: Re: It hits, it Zips!
Post by Gert on Jan 18th, 2005 at 4:17pm
Hello Adam,

If I understand you correctly...

You monitor (for example): C:\Data
You have the ZIPDIR variable set to D:\Zipped

Now, when the file c:\data\sub\hello.txt is created, you want hello.zip be made in D:\Zipped\sub instead of D:\Zipped.

Correct?

Easy, find the line that says

Code (]SET ZIPDIR=D:\Zips
[/code):


And add the following below it:
[code]
IF "%WD_RELDIR%" NEQ "" SET ZIPDIR=%ZIPDIR%\%WD_RELDIR%
MKDIR "%ZIPDIR%"


WD_RELDIR always contains the directory-name, relative to the monitored directory. In my example above, it would contain sub.

Hope that helps,
Gert



Title: Re: It hits, it Zips!
Post by Gert on Jan 18th, 2005 at 4:18pm
By the way, if it is only for one filetype, have a look at this help-page: http://www.watchdirectory.net/watchDir/help/ignore.html
It shows you how you can let watchDirectory only monitor for certain filetypes.

Gert

Title: Re: It hits, it Zips!
Post by adamu on Jan 18th, 2005 at 4:32pm
Gert, that is perfect!   :D

Many thanks.
Adam.

WatchDirectory Forum » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2017. All Rights Reserved.