Solved

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

Posted on 2007-03-20
6
253 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
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 
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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ASP CDO - Limiting Connections 2 36
Alter table 4 22
Help with Sorting Full Text results 2 13
Update data using formula 22 12
Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
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.
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.

939 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

2 Experts available now in Live!

Get 1:1 Help Now