# Mapping from ADLS Gen1 API -> ADLS Gen2 API

ADLS Gen1 API | Note for Gen1 API | ADLS Gen2 API | Note for API Mapping
--- | --- | --- | ---
access/exists | To check if file/directory exists. | N/A | User can use Gen2 API: create_file(if_none_match='*') or create_directory(if_none_match='*') so that the operation will fail on exist.
touch | Create empty file | create_file | The API has the same main purpose for Gen1 and Gen2. However Gen2 create_file API could accept more parameters along with creation.
mkdir | Make new directory | create_directory | The API has the same main purpose for Gen1 and Gen2. However Gen2 create_directory API could accept more parameters along with creation.
stat/info | File information for path | get_file_properties | The Gen1 API is split into two separate ones in ADLS Gen2.
get_directory_properties
unlink/remove/rm | Remove a file or directory | delete_file | The Gen1 API is split into two separate ones in ADLS Gen2.
delete_directory
rmdir | Remove empty directory | delete_directory | Delete directory
ls/listdir | List all elements under directory specified with path | get paths | get_paths(recursive=False) is equal to ls/listdir
walk | Walk a path recursively and returns list of files and dirs(if parameter set) | get_paths() or get_paths(recursive=True) is equal to walk. recursive is True by default.
put | Stream data from local filename to file at path. | append_data together with flush_data | append_data should be followed by flush_data , then the data is actually write into the file. append_data is just to stage the data, not actually write the data into file.
cat | Return contents of file | download_file | Put the expected range parameters in Gen2 API will achieve the same function of the 4 Gen1 APIs.
head | Return first bytes of file
tail | Return last bytes of file
read_block | Read a block of bytes from an ADL file
get | Stream data from file at path to local filename | download_file | Passing a stream parameter in download_file should do the same thing as Gen1 get API does
rename/mv | Move file between locations on ADL | rename_file | Currently ADLS Gen2 only support rename. Move isn't supported yet.
rename_directory
chown | Change owner and/or owning group | set_access_control | Users can set owner, group, acl etc. using the same API.
chmod | Change access mode of path
set_acl | Set the Access Control List (ACL) for a file or folder.
modify_acl_entries | Modify existing Access Control List (ACL) entries on a file or folder. If the entry does not exist it is added, otherwise it is updated based on the spec passed in. No entries are removed by this process (unlike set_acl).
get_acl_status | Gets Access Control List (ACL) entries for the specified file or directory. | get_access_control | The result will include owner, group, acl etc.
remove_acl_entries | Remove existing, named, Access Control List (ACL) entries on a file or folder.If the entry does not exist already it is ignored. Default entries cannot be removed this way, please use remove_default_acl for that. Unnamed entries cannot be removed in this way, please use remove_acl for that. Note: this is by default not recursive, and applies only to the file or folder specified. | N/A | Probably users can achieve the same purpose by calling set_access_control with related parameters.
remove_acl | Remove the entire, non default, ACL from the file or folder, including unnamed entries. Default entries cannot be removed this way, please use remove_default_acl for that. Note: this is not recursive, and applies only to the file or folder specified.
remove_default_acl | Remove the entire default ACL from the folder. Default entries do not exist on files, if a file is specified, this operation does nothing. Note: this is not recursive, and applies only to the folder specified.
open | Open a file for reading or writing to. | N/A | There is no open file operation In ADLS Gen2. However users can do operations to the file directly, eg. append_data, flush_data, download_file
concat/merge | Concatenate a list of files into one new file | N/A | N/A
cp | Not implemented. Copy file between locations on ADL | N/A | N/A
current | Return the most recently created AzureDLFileSystem | N/A | N/A
df | Resource summary of path. eg. File count, directory count | N/A | get_paths could be a helpful API. But user need to do further processing.
du | Bytes in keys at path | N/A | get_paths could be a helpful API. But user need to do further processing.
glob | Find files (not directories) by glob-matching. | N/A | get_paths could be a helpful API. But user need to do further processing.
set_expiry | Set or remove the expiration time on the specified file. This operation can only be executed against files. | N/A | N/A