Class CeL.IO.Windows.file
Windows 下,檔案操作相關之 function。
Defined in: file.origin.js.
Constructor Attributes | Constructor Name and Description |
---|---|
null module constructor
|
Field Attributes | Field Name and Description |
---|---|
<static> <constant> |
CeL.IO.Windows.file.folder_info.f
folder_info 的 flag enumeration
|
<static> |
CeL.IO.Windows.file.fso_attributes
FileSystemObject Object Attributes Property
|
<static> |
CeL.IO.Windows.file.fso_attributes.Alias
Link or shortcut.
|
<static> |
CeL.IO.Windows.file.fso_attributes.Archive
File has changed since last backup.
|
<static> |
CeL.IO.Windows.file.fso_attributes.Compressed
Compressed file.
|
<static> |
CeL.IO.Windows.file.fso_attributes.Directory
Folder or directory.
|
<static> |
CeL.IO.Windows.file.fso_attributes.Hidden
Hidden file.
|
<static> |
CeL.IO.Windows.file.fso_attributes.none
Default.
|
<static> |
CeL.IO.Windows.file.fso_attributes.Normal
Normal file.
|
<static> |
CeL.IO.Windows.file.fso_attributes.ReadOnly
Read-only file.
|
<static> |
CeL.IO.Windows.file.fso_attributes.System
System file.
|
<static> |
CeL.IO.Windows.file.fso_attributes.Volume
Disk drive volume label.
|
<static> |
CeL.IO.Windows.file.iomode
FileSystemObject Object I/O mode enumeration
|
<static> |
CeL.IO.Windows.file.iomode.ForAppending
Open a file and write to the end of the file.
|
<static> |
CeL.IO.Windows.file.iomode.ForReading
Open a file for reading only.
|
<static> |
CeL.IO.Windows.file.iomode.ForWriting
Open a file for writing.
|
<static> <constant> |
CeL.IO.Windows.file.move_file.f
move_file 的 flag enumeration
|
<static> |
CeL.IO.Windows.file.move_file.f.copy
copy, instead of move the file
|
<static> |
CeL.IO.Windows.file.move_file.f.fuzzy
If source don't exist but target exist, than reverse.
|
<static> |
CeL.IO.Windows.file.move_file.f.include_folder
include folder
|
<static> |
CeL.IO.Windows.file.move_file.f.include_subfolder
include sub-folder
|
<static> |
CeL.IO.Windows.file.move_file.f.none
null flag
|
<static> |
CeL.IO.Windows.file.move_file.f.overwrite
overwrite target
|
<static> |
CeL.IO.Windows.file.move_file.f.remove
當 target 指定此 flag,或包含此 flag 而未指定 target 時,remove the source。
|
<static> |
CeL.IO.Windows.file.move_file.f.reverse
reverse source and target
|
<static> |
CeL.IO.Windows.file.move_file.f.Test
Just do a test
|
<static> |
CeL.IO.Windows.file.open_format
FileSystemObject Object file open format enumeration
|
<static> |
CeL.IO.Windows.file.open_format.TristateFalse
Opens the file as ASCII.
|
<static> |
CeL.IO.Windows.file.open_format.TristateTrue
Opens the file as Unicode.
|
<static> |
CeL.IO.Windows.file.open_format.TristateUseDefault
Opens the file using the system default.
|
<static> <constant> |
CeL.IO.Windows.file.traverse_file_system.f
traverse_file_system 的 flag enumeration
|
<private> <static> |
CeL.IO.Windows.file.traverse_file_system.f.driver
用於指示 driver
|
<private> <static> |
CeL.IO.Windows.file.traverse_file_system.f.file
用於指示 file
|
<private> <static> |
CeL.IO.Windows.file.traverse_file_system.f.folder
用於指示 folder
|
<private> <static> |
CeL.IO.Windows.file.traverse_file_system.f.func_length
handle function 應有的長度
|
<static> |
CeL.IO.Windows.file.traverse_file_system.f.get_object
return object
|
<static> |
CeL.IO.Windows.file.traverse_file_system.f.no_traverse
不深入下層子目錄及檔案
|
<private> <static> |
CeL.IO.Windows.file.traverse_file_system.f.NULL
null flag
|
<static> |
CeL.IO.Windows.file.traverse_file_system.f.traverse
深入下層子目錄及檔案
|
Method Attributes | Method Name and Description |
---|---|
<static> |
CeL.IO.Windows.file.Ado_binary(data, pos)
轉換以 adTypeBinary 讀到的資料
|
<private> <static> |
CeL.IO.Windows.file.Ado_binary#newDOM()
|
<private> <static> |
CeL.IO.Windows.file.Ado_binary#newFS(FP)
|
<private> <static> |
CeL.IO.Windows.file.Ado_binary#readData(len)
read data
|
<static> |
CeL.IO.Windows.file.Ado_binary#renew()
實際上沒多大效用。實用解決法:少用 AdoStream.Write()
|
<static> |
CeL.IO.Windows.file.Ado_binary#setData(data, pos)
設定 data
|
<static> |
CeL.IO.Windows.file.change_attributes(F, A)
改變檔案之屬性。
chmod @ UNIX
|
<static> |
CeL.IO.Windows.file.folder_info(folder_path, file_filter, traverseSubDirectory)
Get the infomation of folder
|
<static> |
CeL.IO.Windows.file.get_file_details(fileObj, parentDirObj)
get file details (readonly)
|
<static> |
CeL.IO.Windows.file.iconv_file(fileName, toCode, fromCode, encodeFunction)
將編碼為fromCode之檔案fileName中所有不合編碼toCode之char以encodeFunction轉換
|
<static> |
CeL.IO.Windows.file.move_1_file(from, to, dir, only_filename, reverse)
move file
|
<static> |
CeL.IO.Windows.file.move_file(from, to, base_path, flag, filter)
move/rename files, ** use RegExp, but no global flag **
可用 move_file_filter() 來排除不要的 本函數可能暫時改變目前工作目錄! |
<static> |
CeL.IO.Windows.file.open_file(FN, format, io_mode)
提供給 read_file, write_file 使用的簡易開檔函數
|
<static> |
CeL.IO.Windows.file.openDataTest(FN, NOTexist, io_mode)
開檔處理
測試是否已開啟資料檔之測試與重新開啟資料檔 |
<static> |
CeL.IO.Windows.file.read_file(FN, format, io_mode, func)
讀取檔案
|
<static> |
CeL.IO.Windows.file.translate_AdoStream_binary_data(data, len, type)
轉換以 adTypeBinary 讀到的資料
|
<static> |
CeL.IO.Windows.file.traverse_file_system(FS_function_array, path, filter, flag)
巡覽 file system 的公用函數
|
<static> |
CeL.IO.Windows.file.write_file(FN, content, format, io_mode, N_O)
將 content 寫入 file
** ADODB.Stream does not support appending!
|
Field Detail
<static> <constant>
CeL.IO.Windows.file.folder_info.f
folder_info 的 flag enumeration
<static>
CeL.IO.Windows.file.fso_attributes
FileSystemObject Object Attributes Property
- Since:
- 2010/1/9 08:33:36
- See:
- Attributes Property
<static>
CeL.IO.Windows.file.fso_attributes.Alias
Link or shortcut. Attribute is read-only.
<static>
CeL.IO.Windows.file.fso_attributes.Archive
File has changed since last backup. Attribute is read/write.
<static>
CeL.IO.Windows.file.fso_attributes.Compressed
Compressed file. Attribute is read-only.
<static>
CeL.IO.Windows.file.fso_attributes.Directory
Folder or directory. Attribute is read-only.
<static>
CeL.IO.Windows.file.fso_attributes.Hidden
Hidden file. Attribute is read/write.
<static>
CeL.IO.Windows.file.fso_attributes.none
Default. No attributes are set.
<static>
CeL.IO.Windows.file.fso_attributes.Normal
Normal file. No attributes are set.
<static>
CeL.IO.Windows.file.fso_attributes.ReadOnly
Read-only file. Attribute is read/write.
<static>
CeL.IO.Windows.file.fso_attributes.System
System file. Attribute is read/write.
<static>
CeL.IO.Windows.file.fso_attributes.Volume
Disk drive volume label. Attribute is read-only.
<static>
CeL.IO.Windows.file.iomode
FileSystemObject Object I/O mode enumeration
- See:
- OpenTextFile Method
<static>
CeL.IO.Windows.file.iomode.ForAppending
Open a file and write to the end of the file.
<static>
CeL.IO.Windows.file.iomode.ForReading
Open a file for reading only. You can't write to this file.
<static>
CeL.IO.Windows.file.iomode.ForWriting
Open a file for writing.
<static> <constant>
CeL.IO.Windows.file.move_file.f
move_file 的 flag enumeration
<static>
CeL.IO.Windows.file.move_file.f.copy
copy, instead of move the file
<static>
CeL.IO.Windows.file.move_file.f.fuzzy
If source don't exist but target exist, than reverse.
- Deprecated:
- TODO
<static>
CeL.IO.Windows.file.move_file.f.include_folder
include folder
<static>
CeL.IO.Windows.file.move_file.f.include_subfolder
include sub-folder
<static>
CeL.IO.Windows.file.move_file.f.none
null flag
<static>
CeL.IO.Windows.file.move_file.f.overwrite
overwrite target
<static>
CeL.IO.Windows.file.move_file.f.remove
當 target 指定此 flag,或包含此 flag 而未指定 target 時,remove the source。
<static>
CeL.IO.Windows.file.move_file.f.reverse
reverse source and target
<static>
CeL.IO.Windows.file.move_file.f.Test
Just do a test
<static>
CeL.IO.Windows.file.open_format
FileSystemObject Object file open format enumeration
- See:
- OpenTextFile Method
<static>
CeL.IO.Windows.file.open_format.TristateFalse
Opens the file as ASCII.
<static>
CeL.IO.Windows.file.open_format.TristateTrue
Opens the file as Unicode.
<static>
CeL.IO.Windows.file.open_format.TristateUseDefault
Opens the file using the system default.
<static> <constant>
CeL.IO.Windows.file.traverse_file_system.f
traverse_file_system 的 flag enumeration
<private> <static>
CeL.IO.Windows.file.traverse_file_system.f.driver
用於指示 driver
<private> <static>
CeL.IO.Windows.file.traverse_file_system.f.file
用於指示 file
<private> <static>
CeL.IO.Windows.file.traverse_file_system.f.folder
用於指示 folder
<private> <static>
CeL.IO.Windows.file.traverse_file_system.f.func_length
handle function 應有的長度
<static>
CeL.IO.Windows.file.traverse_file_system.f.get_object
return object
<static>
CeL.IO.Windows.file.traverse_file_system.f.no_traverse
不深入下層子目錄及檔案
<private> <static>
CeL.IO.Windows.file.traverse_file_system.f.NULL
null flag
<static>
CeL.IO.Windows.file.traverse_file_system.f.traverse
深入下層子目錄及檔案
Method Detail
<static>
CeL.IO.Windows.file.Ado_binary(data, pos)
轉換以 adTypeBinary 讀到的資料
- Parameters:
- data
- 以 adTypeBinary 讀到的資料
- pos
- position
- Since:
- 2007/9/19 20:58:26
<private> <static>
CeL.IO.Windows.file.Ado_binary#newDOM()
- Returns:
<private> <static>
CeL.IO.Windows.file.Ado_binary#newFS(FP)
- Parameters:
- FP
- Returns:
<private> <static>
CeL.IO.Windows.file.Ado_binary#readData(len)
read data
- Parameters:
- len
- length
- Returns:
<static>
CeL.IO.Windows.file.Ado_binary#renew()
實際上沒多大效用。實用解決法:少用 AdoStream.Write()
- Returns:
<static>
CeL.IO.Windows.file.Ado_binary#setData(data, pos)
設定 data
- Parameters:
- data
- binary data
- pos
- Returns:
<static>
CeL.IO.Windows.file.change_attributes(F, A)
改變檔案之屬性。
chmod @ UNIX
change_attributes(path,'-ReadOnly');
- Parameters:
- F
- file path
- A
- attributes, 屬性
<static>
CeL.IO.Windows.file.folder_info(folder_path, file_filter, traverseSubDirectory)
Get the infomation of folder
var finfo=new folder_info(path or folder object,extFilter,0/1);
- Parameters:
- folder_path
- folder path
- file_filter
- traverseSubDirectory
- Deprecated:
- 以 traverse_file_system 代替
- Returns:
<static>
CeL.IO.Windows.file.get_file_details(fileObj, parentDirObj)
get file details (readonly)
get_file_details('path'); get_file_details('file/folder name',parentDir); get_file_details('path',get_file_details_get_object);
- Parameters:
- fileObj
- parentDirObj
<static>
CeL.IO.Windows.file.iconv_file(fileName, toCode, fromCode, encodeFunction)
將編碼為fromCode之檔案fileName中所有不合編碼toCode之char以encodeFunction轉換
- Parameters:
- fileName
- toCode
- fromCode
- encodeFunction
- Returns:
<static>
CeL.IO.Windows.file.move_1_file(from, to, dir, only_filename, reverse)
move file
- Parameters:
- from
- to
- dir
- only_filename
- reverse
- Requires:
- fso,get_folder,get_file_name,initWScriptObj
<static>
{Object}
CeL.IO.Windows.file.move_file(from, to, base_path, flag, filter)
move/rename files, ** use RegExp, but no global flag **
可用 move_file_filter() 來排除不要的
本函數可能暫時改變目前工作目錄!
可用 move_file_filter() 來排除不要的
本函數可能暫時改變目前工作目錄!
- Parameters:
- {String} from
- from file
- {String} to
- to file
- {String} base_path
- base path
- flag
- {Function} filter
- 可用 filter() 來排除不要的
- Since:
- 2004/4/12 17:25
- Returns:
- {Object} report
- Requires:
- path_separator,fso,WshShell,new_line,Enumerator
<static>
CeL.IO.Windows.file.open_file(FN, format, io_mode)
提供給 read_file, write_file 使用的簡易開檔函數
- Parameters:
- FN
- file path
- format
- open format, e.g., open_format.TristateUseDefault
- io_mode
- open mode, e.g., iomode.ForWriting
<static>
CeL.IO.Windows.file.openDataTest(FN, NOTexist, io_mode)
開檔處理
測試是否已開啟資料檔之測試與重新開啟資料檔
測試是否已開啟資料檔之測試與重新開啟資料檔
- Parameters:
- FN
- file name
- NOTexist
- if NOT need exist
- io_mode
- IO mode
- Returns:
- Requires:
- fso,WshShell,iomode
<static>
{String}
CeL.IO.Windows.file.read_file(FN, format, io_mode, func)
讀取檔案
- Parameters:
- FN
- file path
- format
- open encode = simpleFileDformat
- io_mode
- open IO mode = ForReading
- func
- do this function per line, or [func, maxsize] (TODO)
- Returns:
- {String} 檔案內容
<static>
CeL.IO.Windows.file.translate_AdoStream_binary_data(data, len, type)
轉換以 adTypeBinary 讀到的資料
// 較安全的讀檔: t=translate_AdoStream_binary_data(read_file(FP,'binary')); write_file(FP,t,'iso-8859-1');
- Parameters:
- data
- len
- type
<static>
CeL.IO.Windows.file.traverse_file_system(FS_function_array, path, filter, flag)
巡覽 file system 的公用函數
- Parameters:
- FS_function_array
- file system handle function array
- path
- target path
- filter
- filter
- flag
- see flag
- Returns:
- See:
- FileSystemObject
<static>
CeL.IO.Windows.file.write_file(FN, content, format, io_mode, N_O)
將 content 寫入 file
** ADODB.Stream does not support appending!
- Parameters:
- FN
- file path
- content
- content to write
- format
- open format = simpleFileDformat
- io_mode
- write mode = ForWriting, e.g., ForAppending
- N_O
- DO NOT overwrite
- Returns:
- error No.