Project (part of file name) as Custom Column

Discuss and share scripts and script files...
Post Reply
dietmarvar
Posts: 6
Joined: 27 Aug 2017 03:42

Project (part of file name) as Custom Column

Post by dietmarvar »

I just discovered XYplorer one week ago and am very happy about all the things I can do that I thought are never possible when I was stuck with Microsoft Explorer. Over the last 20 years I collected many thousands of project files. I organized the files into folders by subject area. As a second dimension I wanted to capture the project that this file was created for. I looked into tags or other meta properties however these properties exist mainly for MS Office files. For pdf files, text files or other types of files there are no such file properties. So in order to be able to tag all my files regardless of file type I am maintaining a file suffix "_P#<Project>" for each file.

Using a custom column and scripting I am now able to have the project for each file in a separate column.

Code: Select all

$find = regexmatches(<cc_name>, "^(.*?_P#)", "$1");
$project = regexreplace(<cc_name>, "^(.*?_P#)(.*?(?=\.))(.*$)", "$2");
if (strlen($find) > 1) {return $project};
2017-09-03_23-57-51.png
2017-09-03_23-57-51.png (198.12 KiB) Viewed 1414 times
Very cool, now I can finally see my projects in a separate column. And I can sort by that column (and probably also filter and search which I will figure out next).

admin
Site Admin
Posts: 60602
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Project (part of file name) as Custom Column

Post by admin »

Cool. :tup:

To search by that column it should be enough to prefix the search with the column name, e.g. "Project:Dart".

See also here:
https://www.xyplorer.com/release_14.00.php#ColumnSearch

highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Project (part of file name) as Custom Column

Post by highend »

Shorter...

Code: Select all

if(strpos(<cc_base>, "_P#") != -1) { return regexreplace(<cc_base>, "^(.*_P#)([^.]+)(.*)", "$2"); }
One of my scripts helped you out? Please donate via Paypal

dietmarvar
Posts: 6
Joined: 27 Aug 2017 03:42

Re: Project (part of file name) as Custom Column

Post by dietmarvar »

Thanks Don and highend. I switched to your shorter script version.

Post Reply