Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


Taylor
2014-01-13T05:39:01Z
I am trying to create a VC job that will file some PDF files into folders.

I have a folder full of PDFs called XXXXXX_$$_DATETIME_XXXX_USERNAME.pdf. The first XXXXX before the _ ranges from 5-10 characters, and is to be the name of the folder in which the file is to be placed. I have used the below to get all the text BEFORE the first _ which works OK:

{STRING(Substring|FILENAME|0|{STRING(IndexOf|FILENAME|_)})}

The problem is, I need to incorporate the above into the folder or filename. So basically, a PDF called 12345_20140101_FILE.PDF would copy to C:\Temp\12345\12345_20140101_FILE.PDF.

Whenever I try to use {STRING(Substring|FILENAME|0|{STRING(IndexOf|FILENAME|_)})} in the folder of file name, I get an error about " Illegal characters in path". This could be something to do with the $$ in the file name perhaps? But I cannot find a way around this...

Please help 🙂
Sponsor
Forum information
Support
2014-01-14T08:22:28Z
Could you give a real world example because:

{STRING(Substring|12345_20140101_FILE.PDF|0|{STRING(IndexOf|12345_20140101_FILE.PDF|_)})}

Resolves to: 12345

Which I guess was what you expected?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Taylor
2014-01-14T08:30:22Z
Hi
Yes, I want it to strip the text from the first part of the file, BEFORE the _. That will be used for the new folder name.
If the folder already exists, it should just copy the file. Otherwise it would create the folder then copy the file.
Thanks
Support
2014-01-14T08:33:47Z
So where exactly does this go wrong?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Taylor
2014-01-14T08:38:53Z
Well as I said, I get the error about illegal characters in the folder name when it tries to create the folder when it copies. I'm assuming it's not reading in the variables, and it's trying to create a folder with {{ in it - which won't work.
Support
2014-01-14T08:59:13Z
I think we need some screenshots and real-world values as the Variable by itself work.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Taylor
2014-01-14T23:27:29Z
Hi

OK, here is a screenshot of the folder, and some files:

UserPostedImage

Here is what I want:

1. Get the first part of the filename (before the first _), E.G A11190.
2. Create a new folder with the above value (A11190), if one doesn't already exist.
3. COPY the PDF file, into this folder

Right now, I am trying to do a copy in VC by telling it to copy to:
I:\Archive\{STRING(Substring|{FILENAME}|0|{STRING(IndexOf|{FILENAME}|_)})}\{FILENAME}.pdf

It says there are illegal characters in the path. Should I perhaps add an extra task, that CREATES the folder first, then copy the files?
Cornell Hooton
2014-01-22T22:10:36Z
I ran into exactly the same issue, trying to upload via FTPS to a dynamically-generated folder name. In my case, I specified the following variable construction as the folder name...
{DATENOWADD(Days|-1|ddd)}
That construction evaluated & rendered just fine in the Variables window, but the VC did not evaluate it for actual upload. Instead, VC passed the explicit value "{DATENOWADD(Days|-1|ddd)}" to the FTP site, resulting in the "illegal character" error.

Workaround: What I did was to create a new user-defined variable, itself defined as " {DATENOWADD(Days|-1|ddd)}", and *that* UD variable exhibited exactly the same failure-to-evaluate issue as the FTP upload in the "Variables" window.

But--by using the UD variables area--I could then play around with alternative combinations of the native VC variables, until it properly generated the weekday-before-today string that I sought.

With the new user-defined variable operational, then I used that variable successfully in the FTPS upload. I'd suspect that you can use the same approach to get to where you want; and, you might even need to use a {ud-variable inside a ud-variable} to get to the resulting string you want.
Taylor
2014-01-22T22:22:30Z
I did try storing the variables that I wanted into a UD variable, but I still got the same error... I am not sure what to do here.
Support
2014-01-23T10:33:26Z
Originally Posted by: Taylor 

I did try storing the variables that I wanted into a UD variable, but I still got the same error... I am not sure what to do here.



About the error. I think you should use the File write Task or Popup Task to write or show you the value after manipulating it with Variables. Then you will see what is wrong with it an alter the Variable accordingly. You need to confirm this before trying to work with the Variable.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top