Just want to elaborate on what I meant by 'error trapping' link-info. [ link-info dup symbolic-link? [ drop ] [ size>> + ]
In python's syntax, I would write the above quot as something like: try: file_info = link_info(dir_entry) if not is_symbolic_link(file_info): total_size += get_fize(file_info) except: pass continue ------------------------ HP ---------- Forwarded message ---------- From: HP wei <hpwe...@gmail.com> Date: Thu, Oct 1, 2015 at 9:36 AM Subject: how to error trapping 'link-info' To: factor-talk@lists.sourceforge.net As suggested by John, I test out the following action to get the total file sizes of a disk volume. 0 "a_path_to_big_folder" [ link-info dup symbolic-link? [ drop ] [ size>> + ] if ] each-file Our big-folder is on a netapp server shared by tens of people. Many small files get updated every minutes if not seconds. The update may involve removing the file first. It has many many subfolders which in turn have more subfolders. Each subfolder may have hundreds of files (occasionally in the thousands). After a few day's discussion with factor guru's, I understand that each-file traverses the directory structure by first putting entries of a folder in a sequence. And it processes each entry one by one. Although this may not cause using big chunk of memory at a time, it does have the following issue.. ------------------------ Last night, I left the command running and came back this morning to find that it failed with the message. lstat: "a path to a file" does not exist !!! This is because after 'each-file' puts the file into the sequence and then when it is its turn to be processed, it is not there at the time!! Without error trapping, the above "0 ... each-file" could not work in our case. So, I guess I would need to do error-trapping on the word link-info. I do not know how to do it. Any hint ? Thanks HP
------------------------------------------------------------------------------
_______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk