Home Forums SQL Server 7,2000 General Copy and rename a file using stored procedure in SQL server 2005 RE: Copy and rename a file using stored procedure in SQL server 2005

  • anilkumarg 33214 - Friday, February 3, 2017 4:03 PM

    Jeff Moden - Saturday, August 16, 2008 7:57 PM

    You CAN have file names with spaces (although, I prefer not to). And, you can easily run commands on those file names by enclosing the filename in double quotes... like this...EXEC master..xp_cmdshell 'RENAME "C:\Webservices\datasource\TradeDetail04-02-08 00_00_00 .txt" TradeDetail.txt'

    Hi How do change the Date modified on a file using XP_CMDSHELL COPY Sourcefile to Destination File

    In general, the file would have to be modified and a COPY doesn't modify the file.  Neither does a RENAME  There is a way to do it but I've forgotten... it was almost 35 years ago when I did such a thing and haven't had to do the same since then.  Perhaps a visit to Yabingoolehoo would be worthwhile on that subject.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)