Size: 1940
Comment: New Version + Development workspace added
|
Size: 2415
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
= Dealing with Files and Directories = | = FileAndDirs: Dealing with Files and Directories = |
Line 3: | Line 3: |
{{{WinFile}}} is part of the CategoryAplApl project. | {{{FileAndDirs}}} is part of the CategoryAplTree project. |
Line 9: | Line 9: |
Nowadays if there is a need to deal with directories and files, there is .NET, isn't it? Well, some companies have decided against .NET, so there is still the need for a .NET-free solution to this. This is what the WinFile class is designed for. | With version 15.0 Dyalog has introduced several new system functions that make it much easier to write platform independent code when it comes to dealing with files and directories. |
Line 11: | Line 11: |
But there is more to say to this: try to get a DirectoryInfo for a directory with, say, 100,000 files. Then compare with this class. | However, there are some gaps left: copying and moving files for example, or a recursive directory listing. |
Line 13: | Line 13: |
See the list of methods (generated with [[ADOC]]): | `FilesAndDirs` aims to close this gap: it offers the same functionality for Windows, Linux and Mac OS. == Slashes and backslashes == Under Windows the backslash `\` character is used as delimiter. Under Linux and Mac OS it is the `/` character. However, Windows is willing to accept the `/` rather than the `\` in most cases, and in all when we do something by a program. The easiest way therefore seems to be to use `/` everywhere. Yes and no. A backslash character is under Linux potentially a legal character in a filename or a directory name. That can cause problems of course if you specify a `\` character under Linux by accident. `FilesAndDirs` normalizes all filenames and all directory names for you, so you cannot forget this. That's the reason why the class offers method like `Exists`, `CreateFile` and `DeleteFile`: they don't do much more than their system function equivalents, accept that they normalize any filenames and directory names. Of course this means that `FilesAndDirs` cannot deal under Linux and Mac OS with names that contain a `\`, but if you try to write platform independent code then you should not do this anyway. |
Line 16: | Line 26: |
Line 17: | Line 28: |
*** WinFile (Class) *** Shared Methods: |
|
Line 22: | Line 31: |
DateOf Delete |
CopyTree CreateFile DeleteFile |
Line 25: | Line 35: |
DirX DoesExistDir DoesExistFile GetAllDrives GetDriveAndType GetTempFileName |
Exists GetNewLineCharsFor GetTempFilename |
Line 32: | Line 39: |
History IsDirEmpty ListDirsOnly |
IsDir IsFile IsSymbolicLink ListDirs ListFiles |
Line 37: | Line 46: |
ReadAnsiFile | MoveTree NormalizePath PolishCurrentDir PWD |
Line 40: | Line 52: |
WriteAnsiFile YoungerThan |
|
Line 44: | Line 54: |
Find out more by looking into the documentation [[attachment:WinFileDocumentation.html]] | Find out more by looking into the documentation [[attachment:FilesAndDirsDocumentation.html]] |
Line 46: | Line 56: |
== History == For a full version history: [[WinFile/History|History]] |
== Project Page == For bug reports, future enhancements and a full version history see FilesAndDirs/ProjectPage |
Line 50: | Line 61: |
||Original author:||KaiJaeger|| ||Responsible:||KaiJaeger|| ||Email:||kai@aplteam.com|| ||Current state:||1.2.7|| |
||Original author: ||KaiJaeger || ||Responsible: ||KaiJaeger || ||Email: || kai@aplteam.com || |
Line 55: | Line 65: |
== Download == | `FilesAndDirs` needs version 15.0 Unicode of Dyalog APL, or better. |
Line 57: | Line 67: |
You have two options: you can either download the script for usage: [[http://aplteam2.com/aplwiki/WinFile?action=AttachFile&do=get&target=WinFile.ZIP | Download WinFile script right now]] '''or''' the whole thing, including the development workspace and the script and maybe more for any development or for running the test cases: [[http://aplteam2.com/aplwiki/WinFile?action=AttachFile&do=get&target=WinFile.ZIP | Download development stuff (including the script)]] If you plan to contribute please note that all stuff published as part of the APLAPL project must follow certain [[AplAplStandards|APLAPL-specific standards]]. |
<<Include(APLTreeDownloads)>> |
Line 69: | Line 70: |
CategoryAplApl | CategoryAplTree |
FileAndDirs: Dealing with Files and Directories
FileAndDirs is part of the CategoryAplTree project.
Contents
Overview
With version 15.0 Dyalog has introduced several new system functions that make it much easier to write platform independent code when it comes to dealing with files and directories.
However, there are some gaps left: copying and moving files for example, or a recursive directory listing.
FilesAndDirs aims to close this gap: it offers the same functionality for Windows, Linux and Mac OS.
Slashes and backslashes
Under Windows the backslash \ character is used as delimiter. Under Linux and Mac OS it is the / character. However, Windows is willing to accept the / rather than the \ in most cases, and in all when we do something by a program. The easiest way therefore seems to be to use / everywhere.
Yes and no. A backslash character is under Linux potentially a legal character in a filename or a directory name. That can cause problems of course if you specify a \ character under Linux by accident.
FilesAndDirs normalizes all filenames and all directory names for you, so you cannot forget this. That's the reason why the class offers method like Exists, CreateFile and DeleteFile: they don't do much more than their system function equivalents, accept that they normalize any filenames and directory names.
Of course this means that FilesAndDirs cannot deal under Linux and Mac OS with names that contain a \, but if you try to write platform independent code then you should not do this anyway.
Methods
Cd CheckPath CopyTo CopyTree CreateFile DeleteFile Dir Exists GetNewLineCharsFor GetTempFilename GetTempPath IsDir IsFile IsSymbolicLink ListDirs ListFiles MkDir MoveTo MoveTree NormalizePath PolishCurrentDir PWD RmDir Version
Find out more by looking into the documentation FilesAndDirsDocumentation.html
Project Page
For bug reports, future enhancements and a full version history see FilesAndDirs/ProjectPage
Version Information
Original author: |
|
Responsible: |
|
Email: |
FilesAndDirs needs version 15.0 Unicode of Dyalog APL, or better.