The following script
in the first part
1. checks if a folder contents a desktop.ini file,
2. if a dektop.ini file is not there, then а per $pathtothefiletoadd predefined desktop.ini file is copied,
3. script makes a record of that action,
in the second part
4. checks if a folder has the "system" attribute set,
5. if not, then the system attribute will be set,
6. script makes a record of that action.
The normal start situation is that the folders to be found have neither desktop.ini file nor the "system" attribute set.
Both script parts are located in the same script file.
XY 15.80 is running.
The problem is that the second part does not function properly if the first part was running right before
and the record made by the second part is strange too - it shows an incorrect action of the second part
it means, that the written lines of the second part record should handle the same folders in the same sequence as that of the first part - and this is not so...
So, to set the "system" attribute to the found files I must quote the first part and then execute the script one more time.
The usually bad result of this script is that far not all folders receive their system attribute set.
Code: Select all
// first part of the script follows
$folderindextosearch = "...";
$pathtothefiletoadd = "...\desktop.ini";
foreach ($a,quicksearch("$folderindextosearch /d","...",<crlf>),<crlf>) {
$b = exists("$a\desktop.ini");
if ($b == 0){
copyto "$a","$pathtothefiletoadd",,1;
writefile("...","<crlf>on $folderindextosearch desktop.ini copied on <date yyyy.mm.dd hh.nn.ss> from $pathtothefiletoadd to $a <*>",a,t);
}
}
// second part of the script follows
foreach ($a,quicksearch("$folderindextosearch /d","...",<crlf>),<crlf>) {
$b = exists("$a\desktop.ini");
$c = attrstamp("s",0,"$a");
if ($b == 1 && $c != "s") {
attrstamp("s",1,"$a");
writefile("...","<crlf>Attribut "system" set on <date yyyy.mm.dd hh.nn.ss> for $a <*>",a,t);
}
}
Please help
XYplorer Beta Club