[Adobe ExtendScript] Get filename information of a File object

/* Get full path of file */ File.prototype.getFullPath = function() { return this.fsName; }; /* Get full path of the folder of the file */ File.prototype.getFolderPath = function() { var str = this.fsName; return str.substring(0, str.lastIndexOf("\\")); }; /* Get file name */ File.prototype.getFileName = function() { var str = this.fsName; return str.substring(str.lastIndexOf("\\") + 1, str.lastIndexOf(".")); }; /* Get file extension */ File.prototype.getFileExtension = function() { var str = this.fsName; return str.substring(str.lastIndexOf(".") + 1); };

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.