Size: 2461
Comment:
|
Size: 2415
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
## page was copied from WinFile = WinFile: Dealing with Files and Directories = |
= FileAndDirs: Dealing with Files and Directories = |
Line 4: | Line 3: |
{{{WinFile}}} is part of the CategoryAplTree project. | {{{FileAndDirs}}} is part of the CategoryAplTree project. |
Line 9: | Line 8: |
Nowadays if there is a need to deal with directories and files, there is .NET, right? 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. | |
Line 11: | Line 9: |
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. | 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 13: | Line 11: |
See the list of methods (generated with [[ADOC]]): | 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. |
Line 16: | Line 26: |
<<SeeSaw(section="methods", toshow="<<Show>> the list of methods", tohide="<<Hide>> the list of methods", bg="#FEE1A5", speed="Slow")>> {{{{#!wiki seesaw/methods/methods-bg/hide |
|
Line 23: | Line 30: |
CopyToWithRC | |
Line 25: | Line 31: |
CreateDirParms CreateDirXParms CreateListFilesOnlyParms DateOf Delete DirTree DirX |
CopyTree CreateFile DeleteFile |
Line 33: | Line 35: |
DoesExistDir DoesExistFile DoesExist ExpandEnv ExpandPath GetAllDrives GetDriveAndType GetTempFileName |
Exists GetNewLineCharsFor GetTempFilename |
Line 42: | Line 39: |
History IsDirEmpty IsFilenameOkay IsFoldernameOkay IsValidWin32Filename ListDirsOnly ListFilesOnly ListDirXIndices ListFileAttributes |
IsDir IsFile IsSymbolicLink ListDirs ListFiles |
Line 52: | Line 45: |
MoveToWithRC | |
Line 54: | Line 46: |
MoveTree NormalizePath |
|
Line 56: | Line 50: |
ReadAnsiFile ReadBytesAs8BitSignedIntegersFromFile |
|
Line 60: | Line 52: |
WriteAnsiFile YoungerThan |
|
Line 63: | Line 53: |
}}}} | |
Line 65: | Line 54: |
== Fields == <<SeeSaw(section="fields", toshow="<<Show>> the list of fields", tohide="<<Hide>> the list of fields", bg="#FEE1A5", speed="Slow")>> {{{{#!wiki seesaw/fields/fields-bg/hide {{{ COL_CreationDateName COL_LastAccessDate COL_LastWriteDate COL_Name COL_ShortName COL_Size FA_ARCHIVE FA_COMPRESSED FA_DEVICE FA_DIRECTORY FA_ENCRYPTED FA_HIDDEN FA_NORMAL FA_NOT_CONTENT_INDEXED FA_OFFLINE FA_READONLY FA_REPARSE_POINT FA_SPARSE_FILE FA_SYSTEM FA_TEMPORARY FA_VIRTUAL okay }}} }}}} Find out more by looking into the documentation [[attachment:WinFileDocumentation.html]] |
Find out more by looking into the documentation [[attachment:FilesAndDirsDocumentation.html]] |
Line 99: | Line 58: |
For bug reports, future enhancements and a full version history see WinFile/ProjectPage | For bug reports, future enhancements and a full version history see FilesAndDirs/ProjectPage |
Line 106: | Line 65: |
`WinFile` needs version 13.0 of Dyalog APL. | `FilesAndDirs` needs version 15.0 Unicode of Dyalog APL, or better. |
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.