Page 1 of 1

Rename folder with text from variable

Posted: Wed Sep 12, 2018 8:26 am
by jchasa
Hello,

So is it possible to rename a folder with text from a variable? I have a scrolling field that I am taking a word from in a specific line, and placing that in a variable. Which I know that works because I tested putting into a regular field.

I have a folder in the defaultfolder location that will always be called the same thing for example "Folder Name"

I have tried things like:

rename folder defaultfolder & "/Folder Name" to varFolderName
rename folder Folder Name to field "folderField"

I am hoping it is something with syntax or expected usability that I am just missing, I have looked in the Dictionary, the Wiki etc, at Rename trying to understand but I can not find this use or if it is possible.

Thanks in advance

Re: Rename folder with text from variable

Posted: Wed Sep 12, 2018 8:54 am
by Klaus
HI jchasa,

welcome to the forum!

I always use an absolute pathname to rename files/folder, otherwise it is not always predictable, where the renamed file/folder will end. Been there, done that! :D

Do like this:

Code: Select all

...
put the defaultfolder & "/Folder Name" into tFolder1

## Make sure that field only contains one line of text, no CR, no TAB etc.
put the defaultfolder & "/" & fld "folderField" into tFolder2
rename folder tFolder1 to tFolder2
...
Tested and works. :D

Best

Klaus