Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Rename PATTERN * TO *
- @script jscript
- // Dopus rename script (http://www.gpsoft.com.au/)
- // Add folder name before file name
- DOpus.ClearOutput();
- DOpus.output(DOpus.version);
- function Rename::GetNewName2(strFileName, strFilePath, _fIsFolder, strOldName, strNewName) {
- if (_fIsFolder) {
- DOpus.output(strFileName + " Is Folder");
- return strFileName;
- }
- parentFolder = GetPathLastFolder(new String(strFilePath)).folder;
- if (strFileName.indexOf(parentFolder) === 0) {
- DOpus.output("Not Rename " + strFileName);
- return strFileName
- }
- DOpus.output("Rename " + strFileName + " to " + parentFolder + ' ' + strFileName);
- return parentFolder + ' ' + strFileName;
- }
- function GetPathLastFolder(mypath) {
- mypath = mypath.replace(/(^(\s|\/|\\)+)|((\s|\/|\\)+$)/g, "");
- lastIndex = mypath.lastIndexOf('\\');
- if (lastIndex == -1 || (lastIndex + 1) == mypath.length) return {
- folder: mypath,
- parentPath: ""
- };
- return {
- folder: mypath.substring(lastIndex + 1),
- parentPath: mypath.substring(0, lastIndex)
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement