Rename a file or directory

put/sessions/{sessionId}/files/{fileOrDirectoryPath}
Internal-Use Only

Renames a file or directory at the specified location. Can also be used to move a file or directory to a location that you specify in the path element of the application/vnd.sas.compute.file.properties body. If no path is provided, the file is moved to the current working directory. The move action causes the path for the new file or directory to change.

Request Samples

1

Response Samples

1{
2 "isDirectory": false,
3 "modifiedTimeStamp": "2018-11-07T08:32:45Z",
4 "name": "hello.txt",
5 "path": "test",
6 "readOnly": false,
7 "size": 6,
8 "version": 1,
9 "links": [
10 {
11 "href": "/compute/sessions/RKEY-ses0000/files/test~fs~hello.txt",
12 "method": "GET",
13 "rel": "self",
14 "type": "application/vnd.sas.compute.file.properties",
15 "uri": "/compute/sessions/RKEY-ses0000/files/test~fs~hello.txt"
16 },
17 {
18 "href": "/compute/sessions/RKEY-ses0000/files/test~fs~hello.txt/content",
19 "method": "GET",
20 "rel": "getFile",
21 "type": "text/plain",
22 "uri": "/compute/sessions/RKEY-ses0000/files/test~fs~hello.txt/content"
23 },
24 {
25 "href": "/compute/sessions/RKEY-ses0000/files/test~fs~hello.txt",
26 "method": "DELETE",
27 "rel": "deleteFile",
28 "uri": "/compute/sessions/RKEY-ses0000/files/test~fs~hello.txt"
29 },
30 {
31 "href": "/compute/sessions/RKEY-ses0000/files/test~fs~hello.txt/content",
32 "method": "PUT",
33 "rel": "createFile",
34 "type": "text/plain",
35 "uri": "/compute/sessions/RKEY-ses0000/files/test~fs~hello.txt/content"
36 },
37 {
38 "href": "/compute/sessions/RKEY-ses0000/files/test~fs~hello.txt",
39 "method": "PUT",
40 "rel": "renameFile",
41 "responseType": "application/vnd.sas.compute.file.properties",
42 "type": "application/vnd.sas.compute.file.properties",
43 "uri": "/compute/sessions/RKEY-ses0000/files/test~fs~hello.txt"
44 },
45 {
46 "href": "/compute/sessions/RKEY-ses0000/files/{destinationFile}",
47 "method": "POST",
48 "rel": "copyFile",
49 "responseType": "application/vnd.sas.compute.file.properties",
50 "type": "application/vnd.sas.compute.file.request",
51 "uri": "/compute/sessions/RKEY-ses0000/files/{destinationFile}"
52 }
53 ]
54}

Path Parameters

NameTypeRequiredDescription
fileOrDirectoryPath
string
true

Specifies the file or directory path. In the path value, replace each forward slash with fs.

sessionId
string<object-id>
true

Specifies the ID of the session.

Query Parameters

NameTypeRequiredDescription
expandPath
boolean
false

Specifies whether to return fully qualified paths in response links.

Default:
false
overwrite
boolean
false

Specifies whether to force an overwrite of an existing file or directory if one of the same name exists at the destination path. If you specify true, the request replaces the existing file or directory.

Default:
false

Header Parameters

NameTypeRequiredDescription
If-Match
string
true

Specifies the current ETag of the file or directory resource that you are renaming.

Request Body

Specifies the file or directory name and path elements. The name element is required and the path element is optional. If specified, the 'path' value can contain an absolute path or a path that is relative to the current working directory. Do not replace forward slash characters with fs for the path element.

Provides properties of a file or directory object.

Example:
{"isDirectory":false,"modifiedTimeStamp":"2018-11-07T08:32:45Z","name":"hello.txt","path":"test","readOnly":false,"size":6,"version":1,"links":[{"href":"/compute/sessions/RKEY-ses0000/files/test~fs~hello.txt","method":"GET","rel":"self","type":"application/vnd.sas.compute.file.properties","uri":"/compute/sessions/RKEY-ses0000/files/test~fs~hello.txt"},{"href":"/compute/sessions/RKEY-ses0000/files/test~fs~hello.txt/content","method":"GET","rel":"getFile","type":"text/plain","uri":"/compute/sessions/RKEY-ses0000/files/test~fs~hello.txt/content"},{"href":"/compute/sessions/RKEY-ses0000/files/test~fs~hello.txt","method":"DELETE","rel":"deleteFile","uri":"/compute/sessions/RKEY-ses0000/files/test~fs~hello.txt"},{"href":"/compute/sessions/RKEY-ses0000/files/test~fs~hello.txt/content","method":"PUT","rel":"createFile","type":"text/plain","uri":"/compute/sessions/RKEY-ses0000/files/test~fs~hello.txt/content"},{"href":"/compute/sessions/RKEY-ses0000/files/test~fs~hello.txt","method":"PUT","rel":"renameFile","responseType":"application/vnd.sas.compute.file.properties","type":"application/vnd.sas.compute.file.properties","uri":"/compute/sessions/RKEY-ses0000/files/test~fs~hello.txt"},{"href":"/compute/sessions/RKEY-ses0000/files/{destinationFile}","method":"POST","rel":"copyFile","responseType":"application/vnd.sas.compute.file.properties","type":"application/vnd.sas.compute.file.request","uri":"/compute/sessions/RKEY-ses0000/files/{destinationFile}"}]}
NameTypeRequiredDescription
links
array [Link]
false

Specifies links that apply to this file or directory object.

size
integer<int64>
false

Specifies the size of the file or directory.

Responses

StatusMeaningDescription
200OKThe file or directory was successfully renamed.HeadersSchema
400Bad RequestThe request was invalid. The file or directory cannot be renamed.Schema
412Precondition FailedThe `If-Match` request header did not match the resource's entity tag.Schema
428Precondition RequiredThe request headers did not include an `If-Match` precondition.Schema