Need help on batch file copying

Associate
Joined
24 May 2011
Posts
1,790
Location
West Sussex
Hi all,

My problem is thus:

To begin with i export a bill of materials from solidworks and get an excel spreadsheet.
Secondly i filter the spreadsheet to just have the part numbers that are required.
Thirdly i manually look through every line on the spreadsheet and copy a pdf and dxf file from one folder to another that corresponds to the part number on each line. This third section is the problem as it takes ages with hundreds of part numbers to sift through.

What i would like to be able to do is take a long list of the part numbers in excel and have windows copy all the corresponding files to a file location that i choose.

I am imagining something that, if i had the skills, might be quite easy.


Your help would be greatly appreciated! Thanks.
 
post an example Excel file..

I don't think i can do that for legal reasons but some manipulation of the file would not be a problem. By default it look something like this:

Cell A1= Item Number(text)
A2= PART NUMBER (text)
A3= DESCRIPTION (text)

Column 1 is a number such as 123.
Column 2 is a part code such as 'P003523'
Column 3 is a part description such as 'Large Bracket'

Hopefully this is enough?
 
Alternatively, does anybody know where i might be able to find the information i need to do something like this myself?
 
If all your cells are all on the same row for each file, make a couple of Formulas in the last columns along the lines of this.

if A2 has Product Number, B2 has Part Code, C2 has Part Description

In D2 you'd put
Code:
="COPY C:\SourceDirectory\" & B2 & ".dxf C:\DestinationDirectory\"

In E2 you'd put
Code:
="COPY C:\SourceDirectory\" & B2 & ".pdf C:\DestinationDirectory\"

Copy that Cell down as far as needed, filter the spreadsheet (using AutoFilter) to your desired Product Number and cut and paste column D into a DOS window... then copy and paste Column E into a DOS window afterwards..

or something like that. Its quick and dirty. And no, I havent tested it :)
 
Very dirty! i like it :p lol

Thankyou though, this is great and i have managed to get it working in a basic way. Couple of immediate problems that you might be able to help with:

1) path names with spaces. obviously excel is using the " symbol in its own code so it doesn't copy it. I can try and get the spaces removed in the path name but this may not be possible.

2) Some of the DXFs have multiple editions to generate multiple pages. For example, the part number P005252 shows as P005252_E_0.dxf and P005252_E_1.dxf. I have no problem with the revision letter as there is a column in the spreadsheet i can use to add that in but the number of pages is a bit of a problem :-/ i could obviosuly gernetate more columns that will copy the extra numbers but that might be a bit OTT if you can think of something more simple?

Thanks :)
 
I figured i can just just fill a random cell with the path and the " symbols and then use &M4& to reference the text. This is excellent, i really appreciate your idea :)
 
Still not been able to solve the multiple dxf problem. Is there any way in cmd to copy files that begin with a certain string and may have any other text after that but before the .dxf extension?

for example it would copy both of these:

P005252_E_anytext.dxf
P005252_E_anytext2.dxf

but ignore these:

P005252_D_anytext.dxf
P005252_D_anytext2.dxf
 
Back
Top Bottom