prop:#HardLinks:>1 ?Number of files in a folder
-
zakoul
- Posts: 156
- Joined: 11 Dec 2019 10:44
Number of files in a folder
Is it possible to create a column that would display the number of files in a folder with a property
Windows 11 25H2, 100%
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Number of files in a folder
Use a custom column with a script?
Code: Select all
$hardlinks = property("#hardlinks", <cc_item>);
if ($hardlinks > 1) { return $hardlinks; }
return "";
One of my scripts helped you out? Please donate via Paypal
-
zakoul
- Posts: 156
- Joined: 11 Dec 2019 10:44
Re: Number of files in a folder
Yes. Does the script only work for files?
Can I do it for folders?
To display the number of files in the folder.
Can I do it for folders?
To display the number of files in the folder.
Windows 11 25H2, 100%
-
Horst
- Posts: 1419
- Joined: 24 Jan 2021 12:27
- Location: Germany
Re: Number of files in a folder
There is no such thing as a hard link to a directory in Windows.
Windows 11 Home, Version 26H2 (OS Build 26300.10075)
Portable x64 XYplorer (Actual version, including betas)
Display settings 1920 x 1080 Scale 100%
Everything 1.5.0.1424b (x64), Everything Toolbar 3.5, Listary Pro 7.1.0.47 beta
Portable x64 XYplorer (Actual version, including betas)
Display settings 1920 x 1080 Scale 100%
Everything 1.5.0.1424b (x64), Everything Toolbar 3.5, Listary Pro 7.1.0.47 beta
-
zakoul
- Posts: 156
- Joined: 11 Dec 2019 10:44
Re: Number of files in a folder
The script should count how many hardlinked files are in each folder.
Windows 11 25H2, 100%
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Number of files in a folder
Recursively?The script should count how many hardlinked files are in each folder
One of my scripts helped you out? Please donate via Paypal
-
zakoul
- Posts: 156
- Joined: 11 Dec 2019 10:44
Re: Number of files in a folder
I do not know
Last edited by zakoul on 22 Jul 2021 11:02, edited 1 time in total.
Windows 11 25H2, 100%
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Number of files in a folder
Code: Select all
$files = listfolder(<cc_item>, , 1, <crlf>);
$cntFiles = 0;
foreach($file, $files, <crlf>, "e") {
if (property("#HardLinks", $file) > 1) { $cntFiles++; }
}
return $cntFiles;
One of my scripts helped you out? Please donate via Paypal
-
zakoul
- Posts: 156
- Joined: 11 Dec 2019 10:44
Re: Number of files in a folder
Thanks.
Is it possible to hide zero results and indicate the total number of files after "/"?
For example 13/65 (13-hardlink>1 / 65-all files in folder).
Is it possible to hide zero results and indicate the total number of files after "/"?
For example 13/65 (13-hardlink>1 / 65-all files in folder).
Windows 11 25H2, 100%
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Number of files in a folder
That is no rocket science...
Code: Select all
$files = listfolder(<cc_item>, , 1, <crlf>);
$cntFiles = 0;
foreach($file, $files, <crlf>, "e") {
if (property("#HardLinks", $file) > 1) { $cntFiles++; }
}
return ($cntFiles ? $cntFiles . "/" . gettoken($files, "count", <crlf>) : "");
One of my scripts helped you out? Please donate via Paypal
-
zakoul
- Posts: 156
- Joined: 11 Dec 2019 10:44
-
zakoul
- Posts: 156
- Joined: 11 Dec 2019 10:44
Re: Number of files in a folder
Can I add that the number of hard links is also displayed for the files in the same custom column?
How's that? Will the results be displayed faster?
Last edited by zakoul on 22 Jul 2021 14:44, edited 1 time in total.
Windows 11 25H2, 100%
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Number of files in a folder
2nd post and then combine that stuff...
One of my scripts helped you out? Please donate via Paypal
-
zakoul
- Posts: 156
- Joined: 11 Dec 2019 10:44
Re: Number of files in a folder
Code: Select all
$hardlinks = property("#hardlinks", <cc_item>);
if ($hardlinks > 1) { return $hardlinks; }
$files = listfolder(<cc_item>, , 1, <crlf>);
$cntFiles = 0;
foreach($file, $files, <crlf>, "e") {
if (property("#HardLinks", $file) > 1) { $cntFiles++; }
}
return ($cntFiles ? $cntFiles . "/" . gettoken($files, "count", <crlf>) : "");
And how can you change the color where 100% hits?
So that the color of the text in such cases is displayed in red.
Windows 11 25H2, 100%
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Number of files in a folder
Custom column text doesn't support colorization, maybe assign a label...
One of my scripts helped you out? Please donate via Paypal
XYplorer Beta Club