1.

Solve : Duplicate files with alternate name from list??

Answer»

Trying to figure out a way to do this and wondering if it can be done with a batch or other script. Trying to find a way to take a bunch of files named such as 24.doc  37.doc  44.doc   45.doc and on and on and create duplicate copies of these files with file names in order from a list.

So

24 = John Meyers
37 = Steve Grell
44 = Sue Bruel
45 = Amy Heisler

and I have a query that is like so in order that matches up with the numeric order of files that exist ( there are numeric gaps as when names were deleted, the numbers were deleted and never reused, but the names remaining in column 2 match up with that in column 1's number index.)

John Meyers
Steve Grell
Sue Bruel
Amy Heisler

The 15 Gigs of Documents NUMBERED 24 thru 63542, I have a table that associates that 24 is John M and 37 is Steve G ...etc. so I am able to create a query in order that matches up with the file names in numeric order so that the CORRECT name gets ASSOCIATED with the correct file. Now the problem I am trying to solve is how to read in this list from the query and perform a COPY routine that will go through all files in numeric order and create copies of these files with the correct Names.doc in addition to retaining the original Number.doc by reading in the names from a list that can be as simple as a Names.txt file in raw ascii  .

Stumped with this, I checked into software out there to see if anyone has created any tools to perform such actions and even better file rename doesnt have a feature that will help me with this, so I figured I'd post here to see if anyone has SUGGESTIONS or might be able to share some coding that is beyond my level of coding in which this might be achieved through a batch or VB script or other means.

In the end basically file named 24.doc is now duplicated as John Meyers.doc and file 37.doc is duplicated as Steve Grell.doc ( so " " will likely be needed in the routine because of spaces in file names if the copy routine is utilized.)
If you had a text file, say a csv which looked like this

24,John Meyers
37,Steve Grell
44,Sue Bruel
45,Amy Heisler

etc

it would be easy to make a batch script to copy 24.doc to John Meyers.doc and so on.

Do you, or can you, have such a file?


Yes i could create one quickly through a query for columns number and name in that csv formatQueryList.csv

Code: [Select]24,John Meyers
37,Steve Grell
44,Sue Bruel
45,Amy Heisler
55,Joe Smith
60,Bill Brown
66,Walter Briscoe
74,Mary Ann Jones
994,Sidonia Walcott
11234,Anne-Marie Bolinski

batch script

Code: [Select]echo off
for /f "tokens=1* delims=," %%A in (QueryList.csv) do (
    echo Copy "%%A.doc" "%%B.doc"
    )

output

Code: [Select]Copy "24.doc" "John Meyers.doc"
Copy "37.doc" "Steve Grell.doc"
Copy "44.doc" "Sue Bruel.doc"
Copy "45.doc" "Amy Heisler.doc"
Copy "55.doc" "Joe Smith.doc"
Copy "60.doc" "Bill Brown.doc"
Copy "66.doc" "Walter Briscoe.doc"
Copy "74.doc" "Mary Ann Jones.doc"
Copy "994.doc" "Sidonia Walcott.doc"
Copy "11234.doc" "Anne-Marie Bolinski.doc"
When you are HAPPY that it works as you require change

this

echo Copy "%%A.doc" "%%B.doc"

to this

Copy "%%A.doc" "%%B.doc"

Awesome!  Many Thanks!!!

Impressed with how small that script is and it works perfect!!!!



Discussion

No Comment Found