Yeah, apparently there is no API to rename a file.
However, you can indirectly achieve the "rename" functionality for file with existing APIs as discussed below:
# Assuming we want to rename file fileA to fileB. Both files are under /vol/myvol/mydir
Step 1: Execute file-get-file-info API for existing file:
Get the value of "file-size" from the API response (say, the obtained value is 14)
Step 2: Read the data from the file:
And get the value of "data" from the API response (say, the obtained value is 53756e204175672031322030303a)
Step 3: Write the data into the new non-existing file:
Step 4: Finally delete the original file:
Thanks, but this solution requires a full copy price to pay.
In practice. this is feasible for small files only.
IMHO it doesn't make sense to miss a renaming feature from any file-oriented interface.
Even more strange, there is a directory renaming.
The file-* APIs were created to manipulate ONTAP system files, which are less that 1M. At the time, there was no need to rename files.
The file-* APIs are NOT a replacement for a general file system calls. Please use NFS or CIFS.
- Rick -
Hi Rick, this is a surprise. File-* API contains all is needed to manipulate a filesystem, except for file renaming and file locking.
Furthermore I have some doubts concerning performance, being forced to hex encoding (potentially) large binary contents.
I need NetApp to implement a DMS storage subsystem, and I wanted to stay away from OS dependencies (CIFS for Windows clients, NFS for Unix clients).
However it seems I have to redesign the entire stuff.
Hi Renzo -
I can understand your disappointment; however, I think it is better to work on top of well-know, and well tested file systems. As for OS dependencies, NFS works on Windows and UNIX/Linux; and CIFS works on UNIX/Linux via SAMBA.
- Rick -
NetApp Wins One Silver and One Bronze Stevie® Award in 2022 Stevie Awards for Sales and Customer Service