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

Posted on 2007-03-20
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.
Question by:LJordanMS
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
LVL 10

Expert Comment

ID: 18760069
You can use an ActiveX Script task and FileSystemObject in DTS

Author Comment

ID: 18760086
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?
LVL 10

Accepted Solution

ksaul earned 250 total points
ID: 18760098
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
How Blockchain Is Impacting Every Industry

Blockchain expert Alex Tapscott talks to Acronis VP Frank Jablonski about this revolutionary technology and how it's making inroads into other industries and facets of everyday life.

LVL 16

Expert Comment

ID: 18761150
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.

Author Comment

ID: 18764353
How would you implement the execute process for xcopy using a DTS?
LVL 16

Expert Comment

ID: 18765173
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

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

636 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