Steven P Posted August 16, 2018 Share Posted August 16, 2018 Good morning, I am asking on the chance that someone has done this. I am wanting to saveas a file, adding a suffix or prefix to the file name So Drawing.dwg becomes Drawing_Old.Dwg for example However Drawing_Old.Dwg might exist, does anyone have a routine that will add a (1) (or the next highest number) to the new file name So Drawing.dwg might become Prefix_Drawing_Old(5).dwg (I'm thinking some thing along the lines of this (yeah, I know it needs proper syntax and stuff, just my quick thoughts): Setq drawing (findfile Prefix_Drawing_Old.dwg) If (= nil drawing saveas Prefix_Drawing_Old.dwg) If (/= nil drawing Progn setq x 1 (while (/= drawing nil) findfile Prefix_Drawing_Old(x).dwg setq x (+ 1 x) );end while saveas Prefix_Drawing_Old(x) ))f Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 16, 2018 Share Posted August 16, 2018 You may be better using if I can remember or find it you can get a list of drawing_name*.dwg so sort list and look at last entry is it not 1 or is it last number. It may have used a doslib function. Will try to find. Maybe check Lee-mac.com. Quote Link to comment Share on other sites More sharing options...
Steven P Posted August 16, 2018 Author Share Posted August 16, 2018 Thanks Al, I wouldn't have thought of that, that would be a lot neater I think Lee-Mac.com.. schoolboy error not to check there first, whoops. Guess where google is taking me next? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted August 16, 2018 Share Posted August 16, 2018 I am wanting to saveas a file, adding a suffix or prefix to the file nameSo Drawing.dwg becomes Drawing_Old.Dwg for example However Drawing_Old.Dwg might exist, does anyone have a routine that will add a (1) (or the next highest number) to the new file name So Drawing.dwg might become Prefix_Drawing_Old(5).dwg You may refer to my LM:uniquefilename function posted here. Quote Link to comment Share on other sites More sharing options...
Steven P Posted August 17, 2018 Author Share Posted August 17, 2018 Thanks Lee, a genius as ever and much appreciated Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted August 17, 2018 Share Posted August 17, 2018 You're welcome! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.