I have a folder and a file within it. I want to rename the folder. but the problem is when i use "ioctl(filesystem_handle, IO_IOCTL_RENAME_FILE,&rename_etruct);" instruction , it creates a copy of the folder with my new name , not renaming the folder.. is

cancel
Showing results for 
Search instead for 
Did you mean: 

I have a folder and a file within it. I want to rename the folder. but the problem is when i use "ioctl(filesystem_handle, IO_IOCTL_RENAME_FILE,&rename_etruct);" instruction , it creates a copy of the folder with my new name , not renaming the folder.. is

398 Views
abhijiths
Contributor I

printf(New_folder_path, "a:\\%s",New_folder_name );

    //sprintf(New_File_path, "a:\\%s\\%s",New_folder_name,"no_log" );

    sprintf(New_File_path, "a:\\%s\\%s",folder_name,"yes_log" );

    MFS_RENAME_PARAM rename_etruct;

    char Old_path[50],New_path[50];

 

    strcpy(Old_path,File_path);

    strcpy(New_path,New_File_path);

    rename_etruct.OLD_PATHNAME = Old_path;

    rename_etruct.NEW_PATHNAME = New_path;

    error_code = ioctl(filesystem_handle, IO_IOCTL_RENAME_FILE,&rename_etruct);

Labels (1)
0 Kudos
3 Replies

115 Views
abhijiths
Contributor I

Thank you iva for your reply. i have already gone through that PDF but i cant find any solution .... i want to create a folder in SDCard with name ".fsevent" and a file within that folder. i could create that folder, but could not open folder and create a file ... but everything works fine if i change ist name to "fsevent". can't  we  start a directory name with a DOT???

Best Regards,

Abhi

0 Kudos

115 Views
ivadorazinova
NXP Employee
NXP Employee

Hello ,

no, it is not possible because MFS comes from MS-DOS FAT file system.

The name convention is 8.3, 8 characters before dot and 3 chars as extension.

For more information you can also look at MFS User´s Guide for KSDK

I hope this helps.

Best Regards,

Iva

0 Kudos

115 Views
ivadorazinova
NXP Employee
NXP Employee

Hi Abhijith S,

You cannot rename folder and file together. When you want rename file (to another folder), you must delete it or use move or something else.

You can call IO_IOCTL_DELETE_FILE in old file.

A file is moved if the directory paths are different and the file names are the same. A file is renamed if the directory paths are the same and the file names are different.

A directory can be renamed, but cannot be moved.

Please, see documentation Freescale MQX™ RTOS MFS User’s Guide for Kinetis Software Development Kit (KSDK)

all commands are described here.

Best Regards,

Iva

0 Kudos