Search the Community
Showing results for tags 'file rename'.
-
Hello, guys! I need a lisp to rename the current open file. I already have a routine that takes the current file name and creates a string with the new file name (Just six numbers in the old name needs to change)... But I coudn't change the old name for the new name. I've tried to use the (Vl-File-Rename), but I think that i didn't use it right.... Here's go the code: (defun C:changename (n1 n2 n3 n4 n5 n6) (setq new_number (strcat (itoa n1) (itoa n2) (itoa n3) (itoa n4) (itoa n5) (itoa n6))) (setq old_name (strcat (getvar "DWGPREFIX") (getvar "DWGNAME"))) (setq size (strlen old_name)) (setq final (- size 18 )) ; (setq start_name (substr old_name 1 final )) (setq end_name (substr old_name (+ final 7) (- size final))) (setq new_name (strcat start_name new_number end_name)) (alert old_name) (alert new_name) (vl-file-rename old_name new_name) ); end defun The old name is: D:\Profiles\s-Andre.Almeida\Desktop\Autocad\3-157941-012-005.dwg The new name, for example, could be: D:\Profiles\s-Andre.Almeida\Desktop\Autocad\3-666666-012-005.dwg I just need to change the names with the (vl-file-rename) could someone help me?