Due to needing to preserve file timestamps, I have processes that first zip up files before copying them to the secondary node, at which point they are unzipped in the correct directories. We use 7zip.
Now, if I have on the primary node a folder that I'm watching called E:\data, there is an application that will be creating different folders, and possibly subfolders of those folders, and placing files within those folders. I need to maintain this structure but want to zip up and copy only files that are changed. I have File Agent successfully watching the directory, and will act upon the creation of new folders and files within the watched directory. However, I am having a hard time trying to figure out how to capture just the potentially new directory, subdirectory if exists, and files created.
For example, E:\data\newdir\filea.txt might already exist and was processed. Now the application creates a file called E:\data\newdir\fileb.txt. I want to be able to just zip up newdir\fileb.txt, copy that to the secondary node E:\data, and unzip, preserving the newdir\fileb.txt structure. I know how to do all this using 7zip.
The two problems I face are:
1) How can I run a SYSOPTS command from within a specific directory in C:D, if it's even possible? I tried using "SYSOPTS="cmd(cd &StartDir)" before running the sysopts command for 7zip, but that didn't work.
2) Other than passing the directory strings to a Java application for parsing, is there a way within a C:D process script to remove the starting piece of a file path, in this example "E:\data\"? If the number of subdirectories was static, it would be easy to use %FA_#, but unfortunately the level of subdirectories is variable.
Right now I'm leaning towards, for this particular watched directory, creating a rule that calls a process that calls a Java program that does the parsing, passes that to a batch file for zipping, then calls a C:D process for copying, then that process calls a batch file for unzipping, preserving path, if the copy is successful. Kind of a round about way but I'm not sure of any other way to do this.
Pinned topic Getting a path string from File Agent
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2013-03-28T15:22:31Z at 2013-03-28T15:22:31Z by SystemAdmin
Re: Getting a path string from File Agent2013-03-28T14:19:31ZThis is the accepted answer. This is the accepted answer.Maybe I'm thinking about this wrong. My question really should be is there a way to have C:D create directories upon copy?
I originally tried to do zipping of E:\data\newdir\fileb.txt into a file called E:\data\newdir\fileb.7z, then copying that path to the secondary node, where just E:\data exists. However, doing so was giving me a "Remote file open failed. RC=8 FDBK=3" and "open failed for copy output file. fdbk=3" error. Searching this, I found that C:D will throw the first one due to permissions, but just to try and remove that possibility I opened the permissions to full control for everyone on that root directory. The second error is thrown when trying to copy from mapped drives, which in my case is what's happening.
However, after sharing E:\data so that I have \\server1\data and \\server2\data, and then trying to do just a simple copy process or a Send\Receive File through Requester, I still get the same error.
When I create newdir under E:\data, the copy process and Send\Receive File works just file. It appears only to have a problem with directories.
If there is a way to correct this, then my previous problem goes away. But if C:D expects the directory structure to be in place, then I need to keep looking into zipping the directory structure from a root and maintaining that upon unzipping.
SAFlanigan 270003Y0R114 Posts
Re: Getting a path string from File Agent2013-03-28T14:23:43ZThis is the accepted answer. This is the accepted answer.
- SystemAdmin 110000D4XK