Copy .wav files identified in a query, to a set folder on the C: drive

I have a table called call_recordings,  each record contains the details of each call that has been recorded.

It has it has a column called [audio_filepath], this contains the filepath of the corresponding call recording .wav file
e.g. 'C:\AM CR Data\DATA\Audio\31102008\20081031_105508_797_01_004.wav'

What i want to do is run a query and copy all the files into another directory e.g 'C:\Burning\CopiedRec\'

How would i go this?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David H.H.LeeCommented:
Hi meteorelec,
Do you meant update the current old physical location to new directory?
If yes, you can update the query like this:
UPDATE tblRecords
SET audio_filepath=REPLACE(audio_filepath,'C:\AM CR Data\DATA\Audio\31102008\','C:\Burning\CopiedRec\')
meteorelecAuthor Commented:
No i mean actually copying the file to the new directory
David H.H.LeeCommented:
Hi meteorelec,
You can try with this:
exec xp_cmdshell 'copy C:\AM CR Data\DATA\Audio\31102008\ C:\Burning\CopiedRec\'

However, you can check this PAQ regarding the details.
Protecting & Securing Your Critical Data

Considering 93 percent of companies file for bankruptcy within 12 months of a disaster that blocked access to their data for 10 days or more, planning for the worst is just smart business. Learn how Acronis Backup integrates security at every stage

meteorelecAuthor Commented:
x com,
 I'm getting this error message when i execute xp_cmdshell:
 Msg 50001, Level 1, State 50001
xpsql.cpp: Error 1314 from CreateProcessAsUser on line 636
David H.H.LeeCommented:
Hi meteorelec,
It seem like security permission issue. Please check this articles that proposed the setting:

I'm not sure about your permission level there, please provide more details if you need any further assistance.
meteorelecAuthor Commented:
I've acually already read that article when i was getting another error message do do with user no have permission,
once i made the changes mentioned in the artical, i started getting this error message.
David H.H.LeeCommented:
Hi meteorelec,
Perhaps you can try with default "master" database and perform the xp_cmdshell function as proposed.
Can you mention your environment settings there? Let's see any changes that missing there.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.