Article: Why I use the D programming language for scripting
Виталий Фадеев
vital.fadeev at gmail.com
Tue Feb 2 04:24:48 UTC 2021
On Tuesday, 2 February 2021 at 03:53:43 UTC, Виталий Фадеев wrote:
> On Sunday, 31 January 2021 at 20:36:43 UTC, aberba wrote:
>> It's finally out!
>>
>> https://opensource.com/article/21/1/d-scripting
>
> If the article is about scripting, then the article will
> contain examples of scripts used in business.
>
> For example, to delete all dub caches in a directory:
Remove dub cache in subsirectories:
module dubcache;
// Reason:
// each cache take 50 - 200 MB of disk space
// Goal:
// scan dirs and remove caches
//
// ./
// a/
// b/
// .dub/ <- target
// c/
import std;
void main( string[] args )
{
dirEntries( args[0].dirName, SpanMode.shallow )
.filter!( a => a.isDir )
.map!( a => buildPath( a.name, ".dub" ) )
.filter!( a => a.exists )
.each!(
( a )
{
writeln( a );
rmdirRecurse( a );
}
);
}
Source: https://run.dlang.io/is/ah1Vtp
And we see what it not simple as windows .bat
More information about the Digitalmars-d-announce
mailing list