2003-04-27 14:48:24 +00:00
|
|
|
" List contents of current directory "
|
|
|
|
|
|
|
|
" Script variables "
|
2002-05-13 22:13:06 +00:00
|
|
|
| fileManager path files dict |
|
|
|
|
|
2003-04-27 14:48:24 +00:00
|
|
|
" Get default file manager "
|
2002-05-13 22:13:06 +00:00
|
|
|
fileManager := NSFileManager defaultManager.
|
|
|
|
|
2003-04-27 14:48:24 +00:00
|
|
|
|
|
|
|
" Get current path "
|
2002-05-13 22:13:06 +00:00
|
|
|
path := fileManager currentDirectoryPath.
|
|
|
|
|
2003-04-27 14:48:24 +00:00
|
|
|
" Write label on Transcript (for shell it is standard output) "
|
2002-05-13 22:13:06 +00:00
|
|
|
Transcript showLine:( 'Listing of directory: ', path ).
|
|
|
|
|
2003-04-27 14:48:24 +00:00
|
|
|
" Get files from 'path' "
|
2002-05-13 22:13:06 +00:00
|
|
|
files := fileManager directoryContentsAtPath:path.
|
|
|
|
|
2003-04-27 14:48:24 +00:00
|
|
|
" For each file from files do the following ..."
|
2002-05-13 22:13:06 +00:00
|
|
|
files do:
|
|
|
|
[ :file |
|
|
|
|
|
|
|
|
dict := fileManager fileAttributesAtPath: (path / file)
|
|
|
|
traverseLink:NO.
|
2003-04-27 14:48:24 +00:00
|
|
|
|
2002-05-13 22:13:06 +00:00
|
|
|
Transcript showLine:file.
|
|
|
|
|
|
|
|
Transcript showLine: (' Type: ', (dict @ NSFileType)).
|
|
|
|
Transcript showLine: (' Size: ', ((dict @ NSFileSize) stringValue)).
|
|
|
|
Transcript showLine: (' Date: ', ((dict @ NSFileModificationDate)
|
|
|
|
description)).
|
|
|
|
|
|
|
|
Transcript showLine:''
|
|
|
|
]
|
|
|
|
|
|
|
|
|