Rename folder with text from variable

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
Posts: 1
Joined: Wed Sep 12, 2018 8:05 am

Rename folder with text from variable

Post by jchasa » Wed Sep 12, 2018 8:26 am


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

Posts: 11732
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany

Re: Rename folder with text from variable

Post by Klaus » Wed Sep 12, 2018 8:54 am

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



Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”