Jump to content

Rename a file: Difference between revisions

→‎{{header|Processing}}: add root rename part of task
(Add Processing)
(→‎{{header|Processing}}: add root rename part of task)
Line 915:
=={{header|Processing}}==
<lang processing>void setup(){
successboolean sketchfile = rename(sketchPath(oldname"input.txt"), sketchPath(newname"output.txt"));
// rename local file in sketch path
boolean sketchfold = rename(sketchPath("docs"), sketchPath("mydocs"));
String oldname = "input.txt";
// sketches will seldom have write permission to root files/folders
String newname = "output.txt";
boolean successrootfile = rename(sketchPath(oldname)"input.txt", sketchPath(newname)"output.txt");
boolean rootfold = rename("docs", "mydocs");
println(oldname, newname, success);
// true if succeeded, false if failed
 
println(sketchfile, sketchfold, rootfile, rootfold);
// rename local folder in sketch path
oldname = "docs";
newname = "mydocs";
success = rename(sketchPath(oldname), sketchPath(newname));
println(oldname, newname, success);
}
 
Cookies help us deliver our services. By using our services, you agree to our use of cookies.