NDELETE
6 posts
• Page 1 of 1
Re: NDELETE
Ditto ⎕NERASE and ⎕FERASE
sent via GWR WiFi
sent via GWR WiFi
-
Phil Last - Posts: 628
- Joined: Thu Jun 18, 2009 6:29 pm
- Location: Wessex
Re: NDELETE
According to https://en.wikipedia.org/wiki/Trash_(computing)
A quick internet search reveals that the OS API's do not directly support the recycle bin. There is no standard Microsoft.NET mechanism, either. There would be very significant performance and storage implications of putting ALL deleted files into the recycle bin by default, and it would probably render the bin more or less unusable if absolutely everything ended up in there.
Having said that: If it *is* appropriate for your application to use the recycle bin, I am sure we can find a recipe that can be used from APL.
Typically only files deleted via Windows Explorer (but not necessarily other Windows graphical interfaces such as file selection dialogs) will be put into the Recycle Bin; files deleted via the Command Prompt are permanently deleted, as (by default) are files deleted via operating system APIs and applications other than Windows Explorer.
A quick internet search reveals that the OS API's do not directly support the recycle bin. There is no standard Microsoft.NET mechanism, either. There would be very significant performance and storage implications of putting ALL deleted files into the recycle bin by default, and it would probably render the bin more or less unusable if absolutely everything ended up in there.
Having said that: If it *is* appropriate for your application to use the recycle bin, I am sure we can find a recipe that can be used from APL.
-
Morten|Dyalog - Posts: 453
- Joined: Tue Sep 09, 2008 3:52 pm
Re: NDELETE
I knew N/F erase didn't but thought NDELETE was more "windows-y" (so to speak) &
I rarely use Windows Explorer, but the graphical tools I do use must imitate it.
I got caught out by walking up a folder tree trying to remove empty folders: I'd been cleaning up the contents (using another graphic file viewer/editor/deletion tool & then removing the emptied folders with a horrid ancient process which generated a .bat file which ran rmdir on the folders from the tips of the tree branches back up to the top with the removal of non-empty folders obviously failing, which is what we wanted. I think this "DOS" call stuffs things into the recycle bin.
I thought it would be much neater to just open APL & run ⎕NINFO to generate the folder list & ⎕NDELETE inside a d-fn with a guard (to catch the file access error on a non-empty folder) - all my tidying up in one short line.
But I forgot that this is one of those data structures which has a deeply nested folders, but some of the folders contain files AND folders (not use the bottommost ones) - I'd been thinking along the lines of the Dovecot email structure where folder can contain sub-folder OR files, but not both. This is like Courier, where you can have files & folders at each level. Because I was thinking "Dovecot" I failed to filter files out of the result of my ⎕NINFO & lost a few on the way up the tree.
This is a one off exercise to clean the files up & I was showing off APL. No permanent requirement for any change.
I rarely use Windows Explorer, but the graphical tools I do use must imitate it.
I got caught out by walking up a folder tree trying to remove empty folders: I'd been cleaning up the contents (using another graphic file viewer/editor/deletion tool & then removing the emptied folders with a horrid ancient process which generated a .bat file which ran rmdir on the folders from the tips of the tree branches back up to the top with the removal of non-empty folders obviously failing, which is what we wanted. I think this "DOS" call stuffs things into the recycle bin.
I thought it would be much neater to just open APL & run ⎕NINFO to generate the folder list & ⎕NDELETE inside a d-fn with a guard (to catch the file access error on a non-empty folder) - all my tidying up in one short line.
But I forgot that this is one of those data structures which has a deeply nested folders, but some of the folders contain files AND folders (not use the bottommost ones) - I'd been thinking along the lines of the Dovecot email structure where folder can contain sub-folder OR files, but not both. This is like Courier, where you can have files & folders at each level. Because I was thinking "Dovecot" I failed to filter files out of the result of my ⎕NINFO & lost a few on the way up the tree.
This is a one off exercise to clean the files up & I was showing off APL. No permanent requirement for any change.
- crishog
- Posts: 61
- Joined: Mon Jan 25, 2010 9:52 am
Re: NDELETE
On the contrary, ⎕NDELETE is a member of the family of "cross platform file functions", which are supposed to work in exactly the same way under Windows, macOS, Linux (AIX and one someday "soon" Android).
-
Morten|Dyalog - Posts: 453
- Joined: Tue Sep 09, 2008 3:52 pm
Re: NDELETE
I don't really know why I thought ⎕NDELETE would be different - presumably because the Windows tools I use all behave the same way.
I spent about an hour that morning on a Linux server, using the command line interface, which I much prefer, but when I use Android it is almost always on a phone & I have fingers which are too big to type well on fiddly little software keyboards, so I used to use EZ Explorer & now Solid Explorer as graphical file managers - and both of those also implement a recycle bin, although I don't think I've ever used it.
Unthinking habits or assumptions can save time, but are often a bad thing.
I spent about an hour that morning on a Linux server, using the command line interface, which I much prefer, but when I use Android it is almost always on a phone & I have fingers which are too big to type well on fiddly little software keyboards, so I used to use EZ Explorer & now Solid Explorer as graphical file managers - and both of those also implement a recycle bin, although I don't think I've ever used it.
Unthinking habits or assumptions can save time, but are often a bad thing.
- crishog
- Posts: 61
- Joined: Mon Jan 25, 2010 9:52 am
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group