Rename File Name - VisualCron - Forum

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


Yoshi_Mac
16 years ago
Hi,

I would like to rename file name. There are over hundreds files in one folder and their name rule is:

XXXXXXXXXX_YYYYMMDD.pdf (XXXXXXXXXX part is unique)

I would like to rename them to:

XXXXXXXXXX.pdf

Could someone please tell me how I could do this? I am using ver 5.1.6.

Thank you.
Sponsor
Forum information
Support
16 years ago
It seems like, in your case, that you could use two functions (from Variables) to replace everything from the underscore (_). Something like this:

{STRING(Substring|XXXXXXXXXX_20090718.pdf|0|{STRING(IndexOf|XXXXXXXXXX_20090718.pdf|_)})}

Then it depends on how you find the original files. Easiest way would be to setup a File Trigger that watches a folder. Then use Variables from the File Trigger instead of the now hardcoded filename.


Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Yoshi_Mac
16 years ago
Hi Henrik,

Thank you very much for your quick response.

I created a rename file task as a file trigger and used * and {*} in the command to get file names, but it does not work...

Could you please tell me how I could get the file name? Sorry for asking a lot...😊

Thank you very much.
Support
16 years ago
No problem, you can use this value to retrieve the name:

{TRIGGER(Active,LastTrigger,File.Result.Name)}

and full path:

{TRIGGER(Active,LastTrigger,File.Result.FullPath)}
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Yoshi_Mac
16 years ago
Hi Henrik,

The trigger you told me is successfully running. Thank you very much.😁

However, I would like to ask you one more question. When I copy a file into the folder where the trigger is checking, it works fine, but when I copy several files at one time, the job is failed because it tries to rename all of the files using the last file name that the trigger found. I would like to rename each file keeping their original names like following:

A0000000001_20090810.pdf => A0000000001.pdf
A0000000002_20090810.pdf => A0000000002.pdf
A0000000003_20090810.pdf => A0000000003.pdf

I really would appreciate it if you could give me more hint.

Thank you very much for your time.
Support
16 years ago
Ok, what you need is to open the Job settings and check "Put Job in queue" checkbox. This will process one file at a time.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Yoshi_Mac
16 years ago
Thank you very much! I appreciate your time!!😁
Scroll to Top