Subj : js.global.file_rename
To : Mortifis
From : echicken
Date : Mon Aug 19 2019 01:00 pm
Re: js.global.file_rename
By: Mortifis to All on Mon Aug 19 2019 12:53:21
Mo> js.global.file_copy(dir[i], path1 + backslash()+ dir[i].toLowerCase() +
Mo> '.bak');
You don't need to specify js.global except in rare situations. Normally, just saying file_copy or file_rename without prefix is sufficient.
Mo> js.global.file_copy(dir[i], path1 + backslash()+ dir[i].toLowerCase() +
Mo> '.bak');
IIRC dir[i] here includes the full path to the file, so your destination (path1 + backslash() + dir[i].toLowerCase() + '.bak') also has it.
You can use file_getname() to extract just the filename portion of a path:
file_copy(dir[i], backslash(path1) + file_getname(dir[i]) + '.bak');
This might achieve what you're looking for.
Many of these file_* methods return boolean to indicate success/failure, so there may not be an error, but the return value should be false if the operation failed.
---
echicken
electronic chicken bbs - bbs.electronicchicken.com
� Synchronet � electronic chicken bbs - bbs.electronicchicken.com