FilesEx library - returns file information

agraham

Expert
Licensed User
Longtime User
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

EDIT :- Version 1.4 posted. See post #17
 

Attachments

  • FilesEx1.4.zip
    16.3 KB · Views: 313
Last edited:

francisco cobos

Member
Licensed User
Longtime User
Very useful work!,

Is there any possibility of change some characteristic of the file (I'm would like to change de name of the files, for example)?
 

agraham

Expert
Licensed User
Longtime User
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.
 

francisco cobos

Member
Licensed User
Longtime User
any possibility of copy or move a directory with the subdirectories inside?

I use a lot Basic4 in the desktop version, but I miss some features of VB like "Dircopy"

Thanks in advance!
 

agraham

Expert
Licensed User
Longtime User
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.
 

francisco cobos

Member
Licensed User
Longtime User
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!
 

agraham

Expert
Licensed User
Longtime User
I've tried to use the "DirectoryTicksInfo" method
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.
 

mjcoon

Well-Known Member
Licensed User
Hi, is there a file browser control for picking a file from filestore?

(Sounds like a fairly universal need, from other environments!)

Mike.
 

tsteward

Well-Known Member
Licensed User
Longtime User
I have a little problem, probably my misunderstanding.

My Code
B4X:
data()=filesex1.DirectoryStringInfo(MyDir)
CreatedTB.Text=data(1)
EditedTB.Text=Data(3)

The above code produces no errors but the created date and the last edited date are both the same.

I am using windows mobile 6.1 if that make any difference.
Using Resco Explorer it shows the creation date but no other dates.

Also is there a way to get the size of the directory and all sub directories?
 

agraham

Expert
Licensed User
Longtime User
the created date and the last edited date are both the same.
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?
I'm afraid not.
 

mjcoon

Well-Known Member
Licensed User
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().

Mike.
 

mjcoon

Well-Known Member
Licensed User
... Perhaps you could convert it yourself using the alogorithm described here 8.3 filename - Wikipedia, the free encyclopedia

Thanks for that reference, Andrew.

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.

Mike.
 
Top