www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - rmdirRecurse - on NFS file system

reply Vino <vino.bheeman hotmail.com> writes:
Hi All,

    Request your help, the below code works find on normal File 
system, bu if the file system is a NFS file system the below 
code, is not working

if Step = dryrun( Display Only) : Works for both NFS and normal 
file system.
if Step = run (Delete folder) : Does not work on NFS file system 
but works on normal file system.
No error message.

auto coAgedDirClean (string FFs, string Step, int AgeSize) {
auto cAges = AgeSize
auto dFiles = Array!(Tuple!(string, SysTime))(dirEntries(FFs, 
SpanMode.shallow).filter!(a => a.isDir && !globMatch(a.baseName, 
"*DND*") && a.timeCreated < cAges).map!(a => tuple(a.name, 
a.timeCreated)));
if (Step == "run") { dFiles.each!(f => f[0].rmdirRecurse); } 
return dFiles;
}

From,
Vino.B
Feb 11 2018
parent reply Vino <vino.bheeman hotmail.com> writes:
On Monday, 12 February 2018 at 06:52:25 UTC, Vino wrote:
 Hi All,

    Request your help, the below code works find on normal File 
 system, bu if the file system is a NFS file system the below 
 code, is not working

 if Step = dryrun( Display Only) : Works for both NFS and normal 
 file system.
 if Step = run (Delete folder) : Does not work on NFS file 
 system but works on normal file system.
 No error message.

 auto coAgedDirClean (string FFs, string Step, int AgeSize) {
 auto cAges = AgeSize
 auto dFiles = Array!(Tuple!(string, SysTime))(dirEntries(FFs, 
 SpanMode.shallow).filter!(a => a.isDir && 
 !globMatch(a.baseName, "*DND*") && a.timeCreated < 
 cAges).map!(a => tuple(a.name, a.timeCreated)));
 if (Step == "run") { dFiles.each!(f => f[0].rmdirRecurse); } 
 return dFiles;
 }

 From,
 Vino.B
Hi All, Was able to resolve this issue.
Feb 13 2018
parent reply Seb <seb wilzba.ch> writes:
On Tuesday, 13 February 2018 at 16:58:09 UTC, Vino wrote:
 On Monday, 12 February 2018 at 06:52:25 UTC, Vino wrote:
 [...]
Hi All, Was able to resolve this issue.
That's great! BTW I think it would be helpful for future reader who find this thread to know how you resolved your problem.
Feb 13 2018
parent Vino <vino.bheeman hotmail.com> writes:
On Tuesday, 13 February 2018 at 17:01:06 UTC, Seb wrote:
 On Tuesday, 13 February 2018 at 16:58:09 UTC, Vino wrote:
 On Monday, 12 February 2018 at 06:52:25 UTC, Vino wrote:
 [...]
Hi All, Was able to resolve this issue.
That's great! BTW I think it would be helpful for future reader who find this thread to know how you resolved your problem.
Hi All, I just modified the below lines of the code, if (Step == "run" && !dFiles.empty) { dFiles.each!(f => rmdirRecurse(f[0])); } return dFiles; From, Vino.B
Feb 13 2018