This small library lets you get the attributes and dates and times associated with a file or directory as both strings and numbers. It also lets you find all the directories or files within a directory. Help file included in zip. Should work on both desktop and device under .NET 1.0/1.1 and later.
If anyone can think of any more file and directory stuff that is not presently available in B4PPC then please post the suggestion here.
EDIT :- Version 1.1 with FileMove and FileRename added.
EDIT :- Version 1.2 with DirectoryCopy, DirectoryCopytree, DirectoryMoveTree and DirectoryRename added
EDIT :- Zip version 1.2a reposted with corrected Help file. The dll is unchanged.
EDIT :- Source code for dll merging posted. Put it in the Basic4ppc Desktop\Libraries folder.
EDIT :- Version 1.3 posted with source for merging. See post #14
Version 1.1 posted with FileMove and FileRename added. In fact, somewhat surprisingly, there is no direct file rename ability available in .NET - it has to be done by moving a file - i.e copy and delete, so it could be done that way in B4PPC. However I have provided these two functions anyway!
FileRename is in fact a FileMove using the path of the original file as the path of the new file.
See first post for new version. I've tested it but use it at your own risk. DirectorytMoveTree may bend your head a little - it did mine! The top level item moved is NOT the directory, it is all the files in the directory and they must go into a new directory that didn't exist before. This new directory can be made in an existing directory. This behaviour is determined by .NET.
Hi Agrahan, I've tried to use the "DirectoryTicksInfo" method as you explain in the help file, but this not appears as an option after the "FilesEx1."
I'm afraid it is too difficult for me to know if this is a bug or is something tha I have missed...
Thanks anyway!
Sorry, my fault. I renamed it but didn't correct the help. It is called DirectoryDoubleInfo and there is a counterpart for files, FileDoubleInfo. A corrected help file is now posted in a new zip in post #1 of this thread.
I'm a bit too busy to knock up a test app on my device but that doesn't seem unreasonable to me as the dates refer to the directory entry itself, not necessarily when the contents change. On the desktop, NTFS file system, the last accessed and last edited dates for a directory are always the same presumably because NTFS log file activity - the devices simpler file system doesn't.
Also is there a way to get the size of the directory and all sub directories?
Version 1.4 has a new method, SpecialPath, that returns the full path for some special folders. Unlike GetSpecialPath in the Hardware library this works on both desktop and device.
Is it, or could it be, possible to extract the 8.3 version of a filename for a file that has a longer name? I can do it with the Dir DOS command but can it be done within Basic4PPC?
My usage would be to run DOS programs that do not understand long filenames by getting the 8.3 version to pass via Shell() or Process().
You have to call a Win32 API to get a short name. I can see no way of doing it in .NET, understandably as it is only a legacy requirement. Perhaps you could convert it yourself using the alogorithm described here 8.3 filename - Wikipedia, the free encyclopedia
As I suspected, features like "(or "TEXTFI~2.TXT", should "TEXTFI~1.TXT" already exist)" and "digits derived from an undocumented hash of the filename" make it impossible to work out a shortname post-hoc, so I'll have to abandon this scenario.