2012-09-24 10:21 AM
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:
2012-09-24 10:55 AM
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.
2012-09-25 12:01 AM
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 -
2012-09-25 12:45 AM
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.
2012-09-25 08:43 AM
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 -