|
|
1.1 ! root 1: $! Command file to rename many files at once ! 2: $! performing a global string substitution on each name. ! 3: $!Example: ! 4: $! @allrename [...] "-" "_" ! 5: $!changes each `-' in a name into a `_'. ! 6: $! ! 7: $!The device and directory names are not altered. ! 8: $! ! 9: $ p2_length = f$length (p2) ! 10: $ p3_length = f$length (p3) ! 11: $ ! 12: $file_loop: ! 13: $ full_name = f$search("''p1'*.*;*") ! 14: $ if ("''full_name'" .eqs. "") then goto done ! 15: $ original_device = f$parse("''full_name'",,,"DEVICE") ! 16: $ original_dir = f$parse("''full_name'",,,"DIRECTORY") ! 17: $ original_file_name = f$parse("''full_name'",,,"NAME") ! 18: $ original_file_type = f$parse("''full_name'",,,"TYPE") ! 19: $ original_file_version = f$parse("''full_name'",,,"VERSION") ! 20: $ original_file = original_file_name - ! 21: + original_file_type + original_file_version ! 22: $ new_file = original_file ! 23: $ something_done = "false" ! 24: $name_loop: ! 25: $ max_length = f$length(new_file) ! 26: $ index = f$locate("''p2'", new_file) ! 27: $ if (index .ge. max_length) then goto end_of_name ! 28: $ something_done = "true" ! 29: $ new_file = f$extract (0,index,new_file) + p3 - ! 30: + f$extract(index+p2_length,max_length-index,new_file) ! 31: $ goto name_loop ! 32: $end_of_name: ! 33: $ original_file = original_device + original_dir + original_file ! 34: $ new_file = original_device + original_dir + new_file ! 35: $ if (something_done) then - ! 36: rename 'original_file' 'new_file' ! 37: $ goto file_loop ! 38: $done: ! 39: $ exit
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.