Solved

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

Posted on 2007-03-20
6
255 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
ID: 18760069
You can use an ActiveX Script task and FileSystemObject in DTS
0
 

Author Comment

by:LJordanMS
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?
0
 
LVL 10

Accepted Solution

by:
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
0
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
LVL 16

Expert Comment

by:rboyd56
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.
0
 

Author Comment

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

Expert Comment

by:rboyd56
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
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

828 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