1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-11-27 22:18:36 +02:00
Files
OpenIntegrations/docs/en/md/FTP/Common-methods/Update-path.mdx

111 lines
3.7 KiB
Plaintext
Raw Normal View History

2025-08-05 21:48:04 +03:00
---
2025-09-10 14:54:07 +03:00
sidebar_position: 10
2025-08-06 19:06:49 +03:00
description: Update path and other functions to work with FTP in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
2025-08-05 21:48:04 +03:00
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, FTP]
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
2025-08-06 19:06:49 +03:00
# Update path
2025-08-05 21:48:04 +03:00
Changes the object's path to the specified one
2025-08-06 19:06:49 +03:00
`Function UpdatePath(Val Connection, Val Path, Val NewPath) Export`
2025-08-05 21:48:04 +03:00
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| Connection | --conn | Arbitrary | ✔ | Existing connection or connection configuration |
| Path | --old | String | ✔ | Current path to object |
| NewPath | --new | String | ✔ | New path to object |
Returns: Map Of KeyAndValue - Processing result
<br/>
:::tip
2025-09-10 14:54:07 +03:00
The ability to move an object from one directory to another by changing the path depends on the server settings
FTP Command: `RNFR + RNTO`
2025-08-05 21:48:04 +03:00
:::
<br/>
```bsl title="1C:Enterprise/OneScript code example"
2025-10-20 19:41:52 +03:00
Host = FunctionParameters["FTP_IP"];
Port = FunctionParameters["FTP_Port"];
Login = FunctionParameters["FTP_User"];
Password = FunctionParameters["FTP_Password"];
2025-08-05 21:48:04 +03:00
UseProxy = True;
FTPS = True;
ProxySettings = Undefined;
TLSSettings = Undefined; // FTPS
FTPSettings = OPI_FTP.GetConnectionSettings(Host, Port, Login, Password);
If UseProxy Then
2025-10-20 19:41:52 +03:00
ProxyType = FunctionParameters["Proxy_Type"]; // http, socks5, socks4
2025-08-05 21:48:04 +03:00
2025-10-20 19:41:52 +03:00
ProxyAddress = FunctionParameters["Proxy_IP"];
ProxyPort = FunctionParameters["Proxy_Port"];
ProxyLogin = FunctionParameters["Proxy_User"];
ProxyPassword = FunctionParameters["Proxy_Password"];
2025-08-05 21:48:04 +03:00
ProxySettings = OPI_FTP.GetProxySettings(ProxyAddress, ProxyPort, ProxyType, ProxyLogin, ProxyPassword);
EndIf;
If FTPS Then
2025-09-01 14:51:24 +03:00
TLSSettings = OPI_FTP.GetTLSSettings(True);
2025-08-05 21:48:04 +03:00
EndIf;
Connection = OPI_FTP.CreateConnection(FTPSettings, ProxySettings, TLSSettings);
If OPI_FTP.IsConnector(Connection) Then
2025-10-18 23:59:34 +03:00
Result = OPI_FTP.UpdatePath(Connection, "new_dir/pic_from_disk.png", "new_dir/pic_copy.png");
2025-08-05 21:48:04 +03:00
Else
Result = Connection; // Error of connection
EndIf;
```
2025-09-16 09:07:33 +03:00
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
2025-10-07 19:27:04 +03:00
# JSON data can also be passed as a path to a .json file
2025-09-16 09:07:33 +03:00
oint ftp UpdatePath \
2025-10-15 14:32:00 +03:00
--conn "{'set':{'advanced_resolve':true,'domain':'172.33.0.11','login':'bayselonarrend','passive':true,'password':'***','port':'21','read_timeout':'120','write_timeout':'120'},'tls':{'accept_invalid_certs':true,'ca_cert_path':null,'use_tls':true},'proxy':{'login':'proxyuser','password':'***','port':'1080','proxy_type':'socks5','server':'127.0.0.1'}}" \
2025-09-16 09:07:33 +03:00
--old "new_dir/giant.bin" \
--new "new_dir/big.bin"
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
2025-10-07 19:27:04 +03:00
:: JSON data can also be passed as a path to a .json file
2025-09-16 09:07:33 +03:00
oint ftp UpdatePath ^
2025-10-15 14:32:00 +03:00
--conn "{'set':{'advanced_resolve':true,'domain':'172.33.0.11','login':'bayselonarrend','passive':true,'password':'***','port':'21','read_timeout':'120','write_timeout':'120'},'tls':{'accept_invalid_certs':true,'ca_cert_path':null,'use_tls':true},'proxy':{'login':'proxyuser','password':'***','port':'1080','proxy_type':'socks5','server':'127.0.0.1'}}" ^
2025-09-16 09:07:33 +03:00
--old "new_dir/giant.bin" ^
--new "new_dir/big.bin"
```
</TabItem>
</Tabs>
2025-08-05 21:48:04 +03:00
2025-09-12 20:23:31 +03:00
```json title="Result"
{
2025-10-15 14:32:00 +03:00
"result": true,
"close_connection": {
"result": true
}
2025-09-12 20:23:31 +03:00
}
```