Jump to content

How to delete Multiple cad files using excel


Guptil

Recommended Posts

I have about 13000 drawings in my project folder and sub folders, now i got a list of around 2000 drawings to be deleted from our project folder as these will be revised and contractor will resubmitted with new Revision. i want to delete these files from my project folder and by searching manually and deleting is very tedious and time consuming job, any one has or could help me creating VBA to delete these files using Excel list or any other option suggested will be highly appropriated.

 

Many Thanks in advance.

Link to comment
Share on other sites

I would never delete a file unless you are prepared to work 24 hours a day to replace the one you accidently erased. It would be way smarter to copy somewhere as say \Superceded projects\2018. back them all up 1st on to more than 1 device.

 

Dont need a VBA just plain excel get it create a batch file each line is a file to delete. Just copy the column to NOTEPAD and save as say mymove.BAT file run it from Windows command line, bottom left of windows screen.

 

del C:\myprojects\job123\1234546.dwg

del C:\myprojects\job123\1789456.dwg

del C:\myprojects\job123\123????6.dwg

 

You can also do a MOVE its a suppported operting system call for files.

 

move C:\myprojects\job123\1234546.dwg C:\myprojects\job123\Jan2018

move C:\myprojects\job123\1789456.dwg C:\myprojects\job123\Jan2018

move C:\myprojects\job123\123????6.dwg C:\myprojects\job123\Jan2018

Link to comment
Share on other sites

I'm with BIGAL on this one DO NOT delete, there is no undo in a batch file or in VBA, it doesn't matter how certain you are that your code is correct, do not delete or rename in whole live folders. Doing something like this you should always run it first on a copy of the whole directory structure if need be copy the whole drive. and use the move command (I'd even be cautious with move) then once you have checked the results very carefully and only then, delete the folders with the moved files. And keep the copy of the original layout for as long as possible just in case you find a problem later.

Link to comment
Share on other sites

This is actually a very dangerous game to play. Automatic deletion of files can go very wrong, very quickly. Also, as mentioned before, you really shouldn't delete old or obsolete files. You never know if or when you might need them again. Move them to another folder until the project is completed, then, if you're absolutely sure you don't need them anymore, you can delete them.

Link to comment
Share on other sites

Moderator please merge with other post they are basicly the same sort of question and the other post is the answer to the delete or my preference a MOVE.

 

Replace "copy" in guptil post with MOVE.

Link to comment
Share on other sites

@ BIGAL Thanks for your comment and advice, actually i have all the files stored on EDMS (Aconex) as well as i have Exe. files saved as a backup, however its very important for other users if they want to use this code.

 

Regarding code, i can delete/move the files if they are in one directory but in my case my files are under many different sub folders like,

 

P:\1-As Built\AC03\000\CV\DR\Drawings\XX-YYY-CVDR-P-276XXXX-10001-1

P:\1-As Built\AC03\010\CS\DP\Drawings\XX-YYY-CSDP-P-276XXXX-10005-0

P:\1-As Built\AC03\010\AR\AW\Drawings\XX-YYY-ARAW-P-276XXXX-10008-0

 

What changes we have to make in code?

Link to comment
Share on other sites

Awwww....go ahead and delete them. What possible harm could it do? You really don't expect anyone down the road to ask to see one of these drawings do you?

 

Or you can take the approach...better safe than sorry. Given the low cost of storage these days what would be the harm in retaining them?

Link to comment
Share on other sites

If files are all over the place then you need to go back to a line by line approach, you say there in excel if it has the paths set then its easy, if not you will have to add the paths then move copy delete your choice.

 

Support on-site problem

Brand new Pc is not working, Murphys law if its going to break does so in 1st week.

Client I have done a lot of work

Oh you have a tape back drive thats great !!!

Client never backed anything up

Very expensive a weeks worth of work do it all again

Our warranty fix PC not your work.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...