Regex help copy file based on content - VisualCron - Forum

Community forum

jamesTrix
2009-11-26T06:28:32Z
I am trying to create a rule to move files based on content I have been trying to use Regex but with out much luck.

All the files that I want to move are XML based but I want to move files that have a C1 Element that look like the following in to one folder and files that don't have this move to another.

Here is what the C1 Elements would look like

<C1>ad8f9501-9393-480a-acc6-f43a978d9458|46ec22cc-69c4-4530-91d3-5e20f1760403</C1>

AS you might be able to spot the C1 values is made up of 2 GUID's with a pipe command in the middle. Each XML file that I want to move will have 2 different sets of GUIDS

Any help creating a rule Regex rule based on content would help me out heaps.
jamesTrix
2009-11-26T08:14:33Z
This is what I came up with so far..

([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})

Just not sure if visual cron would be up to reading and looking at about 20k worth of files.


Support
2009-11-26T11:29:20Z
It is probably not recommended scanning file content of so many files at a time. If it is a one time run - then use a script instead.

If you want to do this on a regular basic then it is OK in combination with a File Trigger. Then you only scan new files - when then are created.

As for the Regex we are not experts on that but perhaps somebody else in the forum.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
jamesTrix
2009-11-26T17:26:29Z
Hi Henrik,
Thanks for your reply yes I guess it would not be to work on a directory of 20k files but more to look at a directory as files where being created and then move them on a given day it could have to manage 20k worth of files.

I am still pretty new to VC (I used it a few years back but much has changed) I am thinking to create a new job and then creating 2 Copy Jobs one to copy files that match the above Regex and One that does not.

Copy files with a GUID to c:\GUIDFILES\
Copy file with out a GUID to c:\NONGUIDFILES\

I have run in to problems with VC on a trigger if 2 new files are created then VC will only pickup the first file ? (is this maybe a user error setting up a bad trigger ?)

Can I create a Trigger based on a Regex for a file mask eg

only Trigger the Copy task if the file names are either filename1.xml|filename2.xml
Support
2009-11-26T17:33:17Z
You need to check option "Put Job in queue". Then one Trigger will be processed at a time.

No, there is not possible to use regex on file filter but you add a normal file filter - then use regex on the Copy file Task.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Users browsing this topic
Scroll to Top