Regarding Xp_cmdshell

  • Hi ,

    can any one help me in writting the code for renaming the files? actaully we want to add prefix to the existing files, so can any one give me some hint code for that,, below is the sample what result we wnat:

    we have files with Accounts.dat we want to rename is to MSFSAccounts.dat, same we have lot of files and we want to add prefix MSFS to them.

    Please share your thoughts on this.

    thanks,

    Mithun

  • HI ,

    If you use TotalCommander ... there is multi-rename tool and you can very easy rename all your files.

  • actually we want write a pieace of sql code and want to put it in SP but no luck so far

  • Attached is a simple example using xp_cmdshell to create a text file of filenames (in this case jpg files from my temp directory). It then imports this list into a temporary table and uses xp_cmdshell to rename.

    Of course, not all sites allow the use of xp_cmdshell so you may need to check for this first.

    There are bound to be more elegant ways of doing it than this, but this is a fairly basic method.

    BrainDonor

  • Hi,.

    Great, this is what i was looking for , i made some changes as per my req and its giving me the results, its cool...

    Thanks a lot for your time and help....it worked...

    Mithun

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply