Change color based on content of folder?
Change color based on content of folder?
Is there a way to change the color of the folder if a file within that folder has been recently updated?
Re: Change color based on content of folder?
As long as that file is in the selected folder (and not further down in a subfolder of it)?
If the file is modified, the modified timestamp of that folder changes as well. So you
could define several color filters with different colors for different modified ranges...
If the file is modified, the modified timestamp of that folder changes as well. So you
could define several color filters with different colors for different modified ranges...
One of my scripts helped you out? Please donate via Paypal
Re: Change color based on content of folder?
What if the file is a subfolder or two down?
Re: Change color based on content of folder?
colorfilters don't look into single changes for arbitrary files somewhere deep inside a folder structure so
afaik there is no automatism to change the color (at least not if the folder structure is not 100% static).
Scripting could do it but it would require user interaction to fire it... Or an external .ahk tool that
monitors folders and sends a script to that XY instance to change the label for that folder...
afaik there is no automatism to change the color (at least not if the folder structure is not 100% static).
Scripting could do it but it would require user interaction to fire it... Or an external .ahk tool that
monitors folders and sends a script to that XY instance to change the label for that folder...
One of my scripts helped you out? Please donate via Paypal
Re: Change color based on content of folder?
Can you please provide a sample script?
BTW, I don't necessarily need the color of the folder to change.
If I had a way of displaying only folders whose files nested a few layers down have changed recently that would be just as good.
BTW, I don't necessarily need the color of the folder to change.
If I had a way of displaying only folders whose files nested a few layers down have changed recently that would be just as good.
Re: Change color based on content of folder?
Shows the folders from the current active pane that have a file modified in the last
7 days in a new paperfolder... Modify it as you need
7 days in a new paperfolder... Modify it as you need
Code: Select all
$folders = listfolder(, , 2, <crlf>);
$modifiedFiles = quicksearch("ageM: <= 7 d /limitperdir=1");
$paperContent = "";
foreach($folder, $folders, <crlf>, "e") {
$escaped = regexreplace($folder, "([\\.+(){\[^$])", "\$1");
if (regexmatches($modifiedFiles, $escaped . "\\")) {
$paperContent = $paperContent . $folder . <crlf>;
}
}
if ($paperContent) { paperfolder("Modified", $paperContent); }
One of my scripts helped you out? Please donate via Paypal
Re: Change color based on content of folder?
I'll give it a try.
Thanks!
Thanks!
Re: Change color based on content of folder?
The script works great. However, I'm new to scripting and trying to understand exactly how it works.
Can you please explain what each of the following lines do?
Thanks,
Howie
Can you please explain what each of the following lines do?
Code: Select all
$escaped = regexreplace($folder, "([\\.+(){\[^$])", "\$1");
Code: Select all
if (regexmatches($modifiedFiles, $escaped)) {
Howie
Re: Change color based on content of folder?
I've removed the full quote of the script and added code tags to the two lines in
your posting...
I'm replacing all meta characters for the current folder in the loop
with a leading backslash followed by the metacharacter because
I need the escaped path for the following if statement
The regexmatches requires a regex pattern (done in the previous
explanation) and I'm checking here if the folder exists as a part
in the modified files list
your posting...
Code: Select all
$escaped = regexreplace($folder, "([\\.+(){\[^$])", "\$1");
with a leading backslash followed by the metacharacter because
I need the escaped path for the following if statement
Code: Select all
if (regexmatches($modifiedFiles, $escaped)) {
explanation) and I'm checking here if the folder exists as a part
in the modified files list
One of my scripts helped you out? Please donate via Paypal
Re: Change color based on content of folder?
Thank you!
Re: Change color based on content of folder?
Seems to be an issue with the script.
If I have two folders ABC and ABCD and a file is updated within ABCD, both folders ABC and ABCD are in the paper folder even though nothing has been updated in folder ABC.
If I have two folders ABC and ABCD and a file is updated within ABCD, both folders ABC and ABCD are in the paper folder even though nothing has been updated in folder ABC.
Re: Change color based on content of folder?
Screenshot of both folders in the list (last modified date column must be visible as well)?
One of my scripts helped you out? Please donate via Paypal
Re: Change color based on content of folder?
I changed the script to
$folders = listfolder(, , 2, <crlf>);
$modifiedFiles = quicksearch("ageM: <= 1 h /limitperdir=1");
$paperContent = "";
foreach($folder, $folders, <crlf>, "e") {
$escaped = regexreplace($folder, "([\\.+(){\[^$])", "\$1");
if (regexmatches($modifiedFiles, $escaped)) {
$paperContent = $paperContent . $folder . <crlf>;
}
}
if ($paperContent) { paperfolder("Modified", $paperContent); }
since I created the folder earlier in the day.
Folder ABC is empty
Folder ABCD has one recently modified file in it.
The script produces both folders ABC and ABCD
$folders = listfolder(, , 2, <crlf>);
$modifiedFiles = quicksearch("ageM: <= 1 h /limitperdir=1");
$paperContent = "";
foreach($folder, $folders, <crlf>, "e") {
$escaped = regexreplace($folder, "([\\.+(){\[^$])", "\$1");
if (regexmatches($modifiedFiles, $escaped)) {
$paperContent = $paperContent . $folder . <crlf>;
}
}
if ($paperContent) { paperfolder("Modified", $paperContent); }
since I created the folder earlier in the day.
Folder ABC is empty
Folder ABCD has one recently modified file in it.
The script produces both folders ABC and ABCD
- Attachments
-
- 2017-10-30_13-02-53.jpg (23.08 KiB) Viewed 2394 times
Re: Change color based on content of folder?
Replace
with
Code: Select all
if (regexmatches($modifiedFiles, $escaped)) {
Code: Select all
if (regexmatches($modifiedFiles, $escaped . "\\")) {
One of my scripts helped you out? Please donate via Paypal