WatchDirectory Forum
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl
watchDirectory forums >> How to... >> File access error while zipping the files
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl?num=1416601772

Message started by WD_User on Nov 21st, 2014 at 9:29pm

Title: File access error while zipping the files
Post by WD_User on Nov 21st, 2014 at 9:29pm
HI,

I am using the latest WD pro version.

Task is supposed to poll the entire root directory including the subfolder and when it finds a new file, it should zip the files and move the zip file to destination folder on the network.

I have an issue when there are multiple files being copied to the source folder and the task is triggered, it tries to zip the files which are still being copied and errors out.

I changed the task to be triggered by file age, but even then, one one file reached the specified file age, it triggeres the task and the other files which are still being copied errors out with file being used by other program error.

Please help.

I have selected, wait for files (both method) in others tab too.

Title: Re: File access error while zipping the files
Post by Gert on Nov 23rd, 2014 at 8:24am
If I understand you correctly, you want the entire directory zipped if one or more files change. I see how that can be a problem if other files (in that directory) are still locked.

Can't you just remove the check for "create zips for complete directories" and place a check on "add files to existing zip"?

If you then use "dynamic naming" (see http://www.watchdirectory.net/wdhelp/plugins/dynamicname_functions.html ) you can still control where the zip is created. For example use something like

C:\Zips\{replace{\,-,{dir}}}.zip

the file C:\MonitoredDir\Some\Sub\file.txt will be zipped to
C:\Zips\MonitoredDir-Some-Sub.zip

or leave out the {replace} function and use

C:\Zips\{dir}.zip
the file C:\MonitoredDir\Some\Sub\file.txt will be zipped to
C:\Zips\MonitoredDir\Some\Sub.zip

You can also use {relativedir} instead of {dir} which will remove the "MonitoredDir" part.

Anyway, the examples above will only act upon the detected file (which is properly checked if it is "ready/not locked") so it should work fine.


Title: Re: File access error while zipping the files
Post by WD_User on Dec 1st, 2014 at 10:21pm
The file name of the zip file is not that important, but the path of the file which is zipped is very important as the zip file is transferred to different location and has to be unzipped to the same folder structure on the other end.

If I have the files
C:/user1/Cust1/file1.txt
C:/user1/Cust1/file2.txt
C:/user1/Cust1/file3.txt

All these files are zipped to ZipFile1.zip and FTPed destination server and the WD on the other end unzips the files to

C:/user1/Cust1/file1.txt
C:/user1/Cust1/file2.txt
C:/user1/Cust1/file3.txt

so its very important to zip the Dir along with the files.

Title: Re: File access error while zipping the files
Post by Gert on Dec 2nd, 2014 at 5:19am
So you just need to select the option "Store the full path" for "directory info".

Title: Re: File access error while zipping the files
Post by WD_User on Dec 2nd, 2014 at 2:34pm
I have that in my settings.

Title: Re: File access error while zipping the files
Post by WD_User on Dec 2nd, 2014 at 2:48pm
Also, its not watching just one folder, Its watching the path with many subfolders

C:/user1/Cust1/file1.txt
C:/user1/Cust1/file2.txt
C:/user1/Cust1/file3.txt
C:/user2/Cust1/file4.txt
C:/user2/Cust2/file5.txt
C:/user2/Cust3/file6.txt
C:/user3/Cust4/file1.txt
C:/user3/Cust5/file2.txt
C:/user3/Cust6/file3.txt

So, I want entire folder structure zipped along with the files.

Title: Re: File access error while zipping the files
Post by Gert on Dec 3rd, 2014 at 10:30am
Are you saying that the complete path (/user1/cust1) is not included inside the zip?

Title: Re: File access error while zipping the files
Post by WD_User on Dec 3rd, 2014 at 2:44pm
Also, I want one zip files for every poll not individual zips for each file. I move the zip created every 5 minutes.

Title: Re: File access error while zipping the files
Post by WD_User on Dec 4th, 2014 at 8:20pm
Hi Gert,

I saw a check box under directory to watch tab
ignore access denied errors.
I have checked that option.
I do not find any documentaion for this.
Should this solve my issue? It will just ingnore all my files being still written when my task to zip the files and move them kicks off? And the files which were still in use will be picked up by the next poll?

OR is it intended for something different?

Is this new?

Title: Re: File access error while zipping the files
Post by Gert on Dec 5th, 2014 at 8:43am
You really should setup your zip task like attached picture.

DO NOT SET THE OPTION to zip entire directories.

If you set the target zip something like this:
F:\Testing\target\zip-{year}{month}{day}-{hour24}{min}.zip

It will add changed/new files to the same zip when the files are detected in the same minute. The above example would create a zip named
F:\Testing\target\zip-20141205-0815.zip
and a minute later it starts adding files to
F:\Testing\target\zip-20141205-0816.zip

You can then create an additional task monitoring this directory (F:\testing\target) for "old files". Use the "File Age" monitoring method to detect zips older than (for example) 5 minutes. Let this new task copy or upload (or....) those zips.

zip.png (19 KB | 169 )

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