Rename a directory

Moderator: Rathinagiri

Post Reply
User avatar
hmgchang
Posts: 204
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia
Has thanked: 1 time
Been thanked: 4 times

Rename a directory

Post by hmgchang » Sun Apr 22, 2018 5:11 pm

Hi everyone....
Any function to rename a directory ?
Or how to do it with hmg coding ?

Tia
Best rgds
Chang
Just Hmg It !

Carlos Britos
Posts: 220
Joined: Sat Aug 02, 2008 5:03 pm
Has thanked: 6 times
Been thanked: 2 times

Post by Carlos Britos » Sun Apr 22, 2018 8:12 pm

Hi Chang

FRename( cOldFile/folder, cNewFile/folder )

Do not end a file or directory name with a space or a period.
Although the underlying file system may support such names, the Windows shell and user interface does not.

Directory names are stored by the file system as a special type of file, but naming rules for files also apply to directory names.

Carlos
Regards/Saludos, Carlos (bcd12a)

User avatar
mustafa
Posts: 655
Joined: Fri Mar 20, 2009 11:38 am
Location: Alicante - Spain
Been thanked: 68 times

Post by mustafa » Mon Apr 23, 2018 12:15 pm

Hi Chang
Carlos Britos best option
another alternative option

xange1 := "C:\Test\New_Folder1"
xange2 := "C:\Test\New_Folder2"

FRENAME( xange1 , xange2 )

RENAME &xange1 TO &xange2

Regards
Mustafa

User avatar
hmgchang
Posts: 204
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia
Has thanked: 1 time
Been thanked: 4 times

Post by hmgchang » Wed May 02, 2018 6:34 am

Thanks Mr. Carlos and Mr. Mustafa
It works as suggested...
My problem is :

Code: Select all

FRename( "..\abc", "..\def")
I need to rename the current directory

any suggestions
TIA
best rgds
Chang
Just Hmg It !

User avatar
Anand
Posts: 271
Joined: Tue May 24, 2016 4:36 pm
DBs Used: DBF
Has thanked: 51 times
Been thanked: 41 times

Post by Anand » Wed May 02, 2018 9:43 am

Chang, if you are running the exe from current directory or any file opened in current directory, win os will not allow you to rename the current directory.

Regards,

Anand
Image

Post Reply