Page 1 of 1

Extracting part of file name

Posted: Sun Sep 07, 2008 6:25 am
by Robasso
Hi,
I'd like to create a task that can recognize which part of a file name it needs to copy. Files (they're pfds btw, but I guess it doesn't matter) are always formatted as:
author - year - title.pdf
of which I'd like to copy only the "title" part. What would be the easiest way of doing this?
Thanks in advance,
Rob

Extracting part of file name

Posted: Mon Sep 08, 2008 3:06 am
by Oleg
You may use "delemit variable" action.

Suppose you get the file name in the file loop
C:\myfiles\John Smith - 1995 - My book.pdf

In order to extract filename only use variable {ExtractFileNameNoExt()}.
You will get the string "John Smith - 1995 - My book"

Next, use delemit variable and you get standartd comma-separated string: "John Smith","1995","My book"
If you store the result into variable MyVar (for example) you can get any part by number, like this:
MyVar(0) = John Smith
MyVar(1) = 1995
MyVar(2) = My book

Extracting part of file name

Posted: Mon Sep 08, 2008 7:22 am
by Robasso
Thanks!
It works brilliant now!
Great software!
Rob