File System Component  Version 6.14.1
MDK Middleware for Devices with Flash File System
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Groups Pages
Directory Maintenance Routines

Directory maintenance routines perform directory management operations. More...

Functions

fsStatus fpwd (const char *drive, char *buf, uint32_t len)
 Print working directory. More...
 
fsStatus fchdir (const char *path)
 Change working directory. More...
 
fsStatus fmkdir (const char *path)
 Create a directory. More...
 
fsStatus frmdir (const char *path, const char *options)
 Remove a directory. More...
 

Description

Directory maintenance routines perform directory management operations.

The routines are thread safe.

Function Documentation

fsStatus fchdir ( const char *  path)

Change working directory.

Parameters
[in]pathstring specifying the directory path.
Returns
execution status fsStatus

The function fchdir changes the current working directory. It causes the directory named by the path argument to become the current working directory, which is the starting point for path searches for pathnames not beginning with '/' or '\'.

The argument path is specifying the directory path. If the drive prefix is omitted, the Current Drive is used. If path is specifying a file, function returns with status code fsNotDirectory.

fsStatus fmkdir ( const char *  path)

Create a directory.

Parameters
[in]pathstring specifying directory path.
Returns
execution status fsStatus

The function fmkdir is used to make a new directory or any intermediate directories in the path.

The argument path is specifying the directory path. If the drive prefix is omitted, the Current Drive is used. If path is specifying a file or directory that already exists, function returns with status code fsAlreadyExists.

fsStatus fpwd ( const char *  drive,
char *  buf,
uint32_t  len 
)

Print working directory.

Parameters
[in]drivea string specifying the memory or storage device.
[out]bufpointer to string buffer.
[in]lenstring buffer length.
Returns
execution status fsStatus

The function fpwd prints the current working directory.

The argument drive specifies the Drives, Memory Devices and Drivers. The Current Drive is used if an empty string is provided. A NULL pointer is not allowed and will be rejected.

The argument buf point to the array where the absolute path of the current working directory is stored.

The argument len is the size in bytes of the buf array. If len argument is less than maximum path length of the target file system, function returns with fsInvalidParameter and content of buf remains unchanged.

Note
  • Maximum path length for FAT file system with LFN support is 260 bytes and 80 bytes for FAT without LFN support.
fsStatus frmdir ( const char *  path,
const char *  options 
)

Remove a directory.

Parameters
[in]pathstring specifying directory path.
[in]optionsstring specifying function options.
Returns
execution status fsStatus

The function frmdir removes a directory if it is empty. Argument options is used to specify function options.

The argument path is specifying the directory path. If the drive prefix is omitted, the Current Drive is used. If path is specifying a file, function returns with status code fsNotDirectory.

The argument options can be NULL when options are not used or a pointer to a string specifying following option:

Option Description
/S Remove all directories and files in the specified directory including the directory itself.