Subj : js.global.file_rename
To   : All
From : Mortifis
Date : Mon Aug 19 2019 12:53 pm

What is the proper usage of file_rename?  I have a script to move and rename
files but it doesn't seem to work :-/

load("sbbsdefs.js");

if (argc==0)
       path = prompt("Copy/Rename from");
else
       path = argv[0];

if (path==undefined) exit();

if (path.indexOf('*')<0 && path.indexOf('?')<0)
       path += "*"; // No pattern specified

path1 = prompt("Copy/Rename to");

if (path1==undefined) exit();

dir = directory(path,GLOB_PERIOD);

for (i in dir)  {
       if(this.bbs && bbs.sys_status&SS_ABORT) break;
       print('Renaming '+ dir[i] + ' to ' + dir[i].toLowerCase());
       js.global.file_copy(dir[i], path1 + backslash()+ dir[i].toLowerCase() +
'.bak');
       mswait(1);
}

I also tried with file_rename(...)

No errors are reported either way.

Any ideas?



My doctor said I have the body of a 25 year old ... and the mind of a 10 :-/

---
� Synchronet � AlleyCat! BBS - http://alleycat.synchro.net:81