troubleshooting Question

SQL when moving files with xp_cmdshell, it misses some of them - SQL Server 2005

Avatar of robthomas09
robthomas09 asked on
Microsoft DOSMicrosoft SQL Server 2005SQL
7 Comments1 Solution1038 ViewsLast Modified:
Hello experts,

We're running into quite a strange occurrence here, and hope someone can help.  We have a small script here that is designed to simply pick up .TIF images from one folder, and move them to another folder. Our program reads in a .csv file with the file names to be moved, and then runs:

Currently calling a SP that uses SQL's XP_CMDSHELL function to move files from one static directory to another when given a variable filename:

@filename varchar(255)
EXEC xp_cmdshell 'MOVE "C:\Start' + @filename + '" C:\End'

We found that when the move was complete, we started with 500 files in folder 1, and when we counted folder 2, there were only 420.  All 500 had been removed from folder 1 though.  Not sure how 20% of them had been seemingly erased?



Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros