Results 1 to 7 of 7

Thread: batch recoverall

  1. #1
    Member
    Join Date
    2008-12
    Posts
    5
    Login to Give a bone
    0

    Default batch recoverall

    I've spent 2 days trying to find a way to batch recoverall, and not a single person has posted online any code for a script like this. Everyone mentions write a script and use scriptpro, but that doesnt work because you need to manually enter in the drawing filenames and path in the script, not just add the dwg in scriptpro and have it run. The closest I got was setting filedia to 1, and enter in the filenames manually for the script, but I get prompted to hit "close" after every recover - which defeats the purpose of a script in the first place. I need to run recoverall on an entire directory twice (but having a script do it once and I just run it twice is ok).

    Im guessing lisp is the right way to go about doing this, but I have 0 experience with it, and I dont think I can learn it fast enough on my own to write this script (I am switching jobs in 3 weeks). Any advice?

  2. #2
    All AUGI, all the time
    Join Date
    2015-10
    Location
    Belgrade, Serbia, Europe
    Posts
    564
    Login to Give a bone
    0

    Default Re: batch recoverall

    If you want to recover all *.dwg files in specified directory - qsave them in newest file format and you are not annoyed by displaying log message where you must press enter to go on further, you can use this code :

    Code:
    (defun c:rcdir ( / pth filelst)
    (setq pth (getstring "\nType path where are *.dwg files to recover <ex. c:/.../.../> : "))
    (setq filelst (vl-directory-files pth "*.dwg"))
    (foreach file filelst (command "recoverall" (strcat pth file)) )
    (princ)
    )
    M.R.

  3. #3
    Member
    Join Date
    2008-12
    Posts
    5
    Login to Give a bone
    0

    Default Re: batch recoverall

    Thank you! Exactly what I needed. I didnt realize that the problem for us was it needed to be in 2010 format for recoverall to actually work, I thought it was just some strange reason recoverall worked the 2nd time in a row but not the first.

  4. #4
    All AUGI, all the time
    Join Date
    2015-10
    Location
    Belgrade, Serbia, Europe
    Posts
    564
    Login to Give a bone
    0

    Default Re: batch recoverall

    Similar to Thread where is activated script file for multiple open-qsave and closeall, you can use this code to generate script (test.scr) in path you in start specify where are *.dwg files for recover-audit-qsave and closeall... This way you can save your *.dwg files in file format you want (firstly you must specify what will that format be through OPTIONS -> Open&Save Files Tab -> Default save file format (select from drop down bar)... After this you can apply this code :

    Code:
    (defun c:brfd () (c:batchrecoverfilesindir))
    (defun c:batchrecoverfilesindir ( / FILELST FILEN K PTH PTHFILELST SCRFILE)
    (setq pth (getstring "\nSpecify path direcory where are *.dwg files for batch recover-qsave-close <ex. c:/.../.../ : "))
    (setq filelst (vl-directory-files pth "*.dwg"))
    (foreach file filelst (setq pthfilelst (cons (strcat pth file) pthfilelst)) )
    (setq filen (length filelst))
    (setq scrfile (open (strcat pth "test.scr") "w"))
    (setq k -1)
    (repeat filen
    (setq k (1+ k))
    (princ "Recover" scrfile)
    (princ "\n" scrfile)
    (prin1 (nth k pthfilelst) scrfile)
    (princ "\n" scrfile)
    (princ "\n" scrfile)
    (princ "Audit" scrfile)
    (princ "\n" scrfile)
    (princ "Y" scrfile)
    (princ "\n" scrfile)
    (princ "Qsave" scrfile)
    (princ "\n" scrfile)
    )
    (princ "CloseAll" scrfile)
    (princ "\nN" scrfile)
    (princ "\n" scrfile)
    (close scrfile)
    (command "script" (strcat pth "test.scr"))
    (princ)
    )
    (princ "\nType \"brfd\" for batch recover-qsave-close *.dwg files in specified directory")
    (princ)
    M.R.

  5. #5
    Member
    Join Date
    2015-10
    Posts
    7
    Login to Give a bone
    0

    Default Re: batch recoverall

    Marko, I think this is exactly what I'm looking for! But may I ask a newbie question?...what's the next step for using this code?

    Thanks!

  6. #6
    Member
    Join Date
    2005-11
    Location
    Georgia
    Posts
    25
    Login to Give a bone
    0

    Cool Re: batch recoverall

    Great code sir. I snagged it for our use on a file set that got corrupted. Credit for your work was added to the saved code. Much appreciated !

    Quote Originally Posted by marko_ribar View Post
    Similar to Thread where is activated script file for multiple open-qsave and closeall, you can use this code to generate script (test.scr) in path you in start specify where are *.dwg files for recover-audit-qsave and closeall... This way you can save your *.dwg files in file format you want (firstly you must specify what will that format be through OPTIONS -> Open&Save Files Tab -> Default save file format (select from drop down bar)... After this you can apply this code :

    Code:
    (defun c:brfd () (c:batchrecoverfilesindir))
    (defun c:batchrecoverfilesindir ( / FILELST FILEN K PTH PTHFILELST SCRFILE)
    (setq pth (getstring "\nSpecify path direcory where are *.dwg files for batch recover-qsave-close <ex. c:/.../.../ : "))
    (setq filelst (vl-directory-files pth "*.dwg"))
    (foreach file filelst (setq pthfilelst (cons (strcat pth file) pthfilelst)) )
    (setq filen (length filelst))
    (setq scrfile (open (strcat pth "test.scr") "w"))
    (setq k -1)
    (repeat filen
    (setq k (1+ k))
    (princ "Recover" scrfile)
    (princ "\n" scrfile)
    (prin1 (nth k pthfilelst) scrfile)
    (princ "\n" scrfile)
    (princ "\n" scrfile)
    (princ "Audit" scrfile)
    (princ "\n" scrfile)
    (princ "Y" scrfile)
    (princ "\n" scrfile)
    (princ "Qsave" scrfile)
    (princ "\n" scrfile)
    )
    (princ "CloseAll" scrfile)
    (princ "\nN" scrfile)
    (princ "\n" scrfile)
    (close scrfile)
    (command "script" (strcat pth "test.scr"))
    (princ)
    )
    (princ "\nType \"brfd\" for batch recover-qsave-close *.dwg files in specified directory")
    (princ)
    M.R.

  7. #7
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: batch recoverall

    FWIW -

    AutoCAD 2015 introduced the new Recover API, which means that drawings can be recovered without being opened in the Editor (i.e., much, much faster).



    Cheers
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

Similar Threads

  1. Batch Converting CTB to STB
    By brendan.j.mallon in forum Dot Net API
    Replies: 8
    Last Post: 2016-04-15, 02:25 PM
  2. DWG to PDF Batch
    By RockDog in forum AutoCAD General
    Replies: 10
    Last Post: 2009-10-26, 02:08 PM
  3. Batch changes
    By jkg in forum AutoLISP
    Replies: 3
    Last Post: 2009-05-15, 03:16 PM
  4. Batch RECOVERALL.....?
    By eric_snider in forum CAD Management - General
    Replies: 3
    Last Post: 2009-03-14, 03:57 AM
  5. Recoverall & Setbylayer for multiple files
    By ajtrahan in forum AutoLISP
    Replies: 9
    Last Post: 2008-07-29, 06:26 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •