Languages

Menu
Sites
Language
File Path in a Folder
How can I know all file path in a certain folder

Responses

7 Replies
Yasin Ali

Hi~,

Please see the link for file system:

https://developer.tizen.org/development/training/native-application/understanding-tizen-programming/file-system-directory-hierarchy

For Example, exact resource file path according to the filename and directory can be achieved by using the following function.

char* get_filepath(char *filename, char *dir)
{

    char filepath[1000] = {0,};
    char *resource_path = NULL;
    if(!strcmp(dir, "res"))
        resource_path = app_get_resource_path(); /* get the application resource directory path */
    else if(!strcmp(dir, "shared/res"))
        resource_path = app_get_shared_resource_path();/* get shared resource directory path */
    if(resource_path)
    {
        snprintf(filepath,1000,"%s%s",resource_path,filename);
        free(resource_path); /* make resource_path free */
    }

    return filepath;
}

Hope it will work.
If you find my post is helpful for you, please mark it as the Best Answer to promote this post to others.

Mahabub Zoraf
actually , i want to find all file in any location. not only for application resource directory path.
Yasin Ali

Please explain "any location".

Mahabub Zoraf
any location means any folder in your device something like documents, download or even where the crush analytics are.
Yasin Ali

You may use Connection Explorer of Tizen Studio to find connected devices. Then you may expand

device file hierarchy there to see different directories and their contents.

Check https://developer.tizen.org/ko/development/tools/common-tools/smart-development-bridge?langredirect=1#command

command like sdb pull <remote> [<local>]

for getting that file of interest.

Hope it will help.

Yasin Ali

Have you solved your problem ?

Mahabub Zoraf
Yes. In C, you have to include . you have to provide the folder directory path . #include char *folder_dir= "You have to provide Filepath here" ; static char *file_path; DIR *dir; struct dirent *ent; if ((dir = opendir(folder_dir)) != NULL){ while ((ent = readdir (dir)) != NULL) { file_path=malloc(strlen(ent->d_name)+ strlen(folder_dir)+1); strcpy(file_path,folder_dir); strcat(file_path,ent->d_name); } closedir (dir); } else { dlog_print(DLOG_INFO,"TAG","can not open directory"); }