Solved

Is there anyway to move and rename files without using xp_cmdshell??

Posted on 2007-03-20
6
252 Views
Last Modified: 2013-11-30
I have created a couple of DTS that generate execl spreadsheets with data from production.  The problem is I need to archive these spreadsheets, rename them, move them to folders, etc, the problem is that I cant use xp_cmdshell to do so because of security reasons.  Our infrastructure support doenst want anyone use it since it is to powerful and creates to many security issues. Is there anyother way to do what I need to do with these files without using xp_cmdshell? Either using SQL, VB, etc.
0
Comment
Question by:LJordanMS
  • 2
  • 2
  • 2
6 Comments
 
LVL 10

Expert Comment

by:ksaul
Comment Utility
You can use an ActiveX Script task and FileSystemObject in DTS
0
 

Author Comment

by:LJordanMS
Comment Utility
I have never done that before, how do you do that? Is there a resource that I can look at to see how its done?
0
 
LVL 10

Accepted Solution

by:
ksaul earned 250 total points
Comment Utility
For example...
'create some string variables for the oldfile name and new file name
Set fso = CreateObject ("Scripting.FileSystemObject")
      If fso.FileExists (sPath & sOldFileName) Then
            fso.CopyFile sOldPath & sOldFileName, sNewPath  & sNewFileName
            fso.DeleteFile sOldPath & sOldFileName
      End if
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 16

Expert Comment

by:rboyd56
Comment Utility
There is an execute process task that will take a Windows command and execute it. You can use it to run the copy or xcopy command to copy the files or any other executable.
0
 

Author Comment

by:LJordanMS
Comment Utility
How would you implement the execute process for xcopy using a DTS?
0
 
LVL 16

Expert Comment

by:rboyd56
Comment Utility
The caveat to using Xcopy is you would have to know the name of the file you want to copy and where you want to copy it. Unless you can create a batch file to do the work

Add Execute Process Task to package
Win 32 process: xcopy.exe
Parameter:  file to copy and location, i.e. C:\somefile.xls c:\someotherlocation
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now