Parâmetros
fromstringobrigatórioUn file o un dosari.
tostringobrigatórioI suoi folders di padre sono creatis.
// Rename
await pc.files.move("notes.md", "Launch plan/notes.md");
// Move a whole folder
await pc.files.move("Launch plan", "Archive/2026/Launch plan");
// { name: "Launch plan", path: "Archive/2026/Launch plan", type: "folder", … }# Rename
pc.files.move("notes.md", "Launch plan/notes.md")
# Move a whole folder
pc.files.move("Launch plan", "Archive/2026/Launch plan")
# {"path": "Archive/2026/Launch plan"}Nega a su substitut
Un destino che è già prese leva path_exists. Nada è moved, niente è perdut, e la decisione di cosa fare con la collision sta con voi.
import { IaGenifyError } from "iagenify";
async function moveAside(files, from, to) {
try {
return await files.move(from, to);
} catch (err) {
if (err instanceof IaGenifyError && err.code === "path_exists") {
const stamp = new Date().toISOString().slice(0, 10);
return files.move(from, to.replace(/(\.[^.]+)?$/, ` (${stamp})$1`));
}
throw err;
}
}import re
from datetime import date
def move_aside(files, source, destination):
if (files.root / destination).exists():
stamp = date.today().isoformat()
destination = re.sub(r"(\.[^.]+)?$", lambda m: f" ({stamp}){m.group(1) or ''}", destination, count=1)
return files.move(source, destination)Un dossier non può ir dentro di se
move("Work", "Work/old") è rifiutat con invalid_path, prima che si tocchi qualcosa. A sinistra al sistema de files que operazion o failp ou loops.
It's come un bidè de reciclaj è construit
Inserits nascosti stan fora de list(), quindi movendo qualcosa sotto .trash/<timestamp>/ removes-lo da vista mantenendo ogni byte. Is exacta that is what the agent's delete tool does, and you can do us.
const stamp = new Date().toISOString().replace(/[:.]/g, "-");
await pc.files.move("Launch plan/draft.md", `.trash/${stamp}/Launch plan/draft.md`);from datetime import datetime, timezone
stamp = datetime.now(timezone.utc).isoformat().replace(":", "-").replace(".", "-")
pc.files.move("Launch plan/draft.md", f".trash/{stamp}/Launch plan/draft.md")Erros
| Código | Status | Quando |
|---|---|---|
| path_not_found | 404 | Nada a from. |
| path_exists | 409 | to è prelevat. |
| invalid_path | 400 | Absolute, fuori del workspace, la radice, o un folder in se. |
| local_files_require_node | 400 | O ambiente de execução não tem sistema de arquivos. |
| storage_not_on_this_machine | 409 | Un altro computer's stoccage. |