Jump to content
Guptil

How to delete Multiple cad files using excel

Recommended Posts

Guptil

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.

Share this post


Link to post
Share on other sites
BIGAL

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

Share this post


Link to post
Share on other sites
steven-g

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.

Share this post


Link to post
Share on other sites
Cad64

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.

Share this post


Link to post
Share on other sites
BIGAL

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.

Share this post


Link to post
Share on other sites
Guptil

@ 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?

Share this post


Link to post
Share on other sites
ReMark

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?

Share this post


Link to post
Share on other sites
BIGAL

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×