![]() The fields/columns are selected from the files using a standard SQL query (i.e. Personally, I feel dirty changing the modified date using something like "touch" or anything else because the file was, in fact, not modified. Specifies the name of the table into which data is loaded. or just use the date created, which will reflect when the copy was created and will be after the modified date. I've not tested it with any of the OSes past Windows XP or Windows 2000. IIRC, it's a simple copy/paste of the touch executable and then you can use it. When you touch a file, you update the last modified date and time. It's been a while, but I believe there's a Windows port of an old Unix command called touch. Perhaps a visit to Yabingoolehoo would be worthwhile on that subject. it was almost 35 years ago when I did such a thing and haven't had to do the same since then. Neither does a RENAME There is a way to do it but I've forgotten. In general, the file would have to be modified and a COPY doesn't modify the file. Hi How do change the Date modified on a file using XP_CMDSHELL COPY Sourcefile to Destination File like this.EXEC master.xp_cmdshell 'RENAME "C:\Webservices\datasource\TradeDetail04-02-08 00_00_00. ![]() And, you can easily run commands on those file names by enclosing the filename in double quotes. You CAN have file names with spaces (although, I prefer not to). After that, you can delete the original one. Why not use MOVE, which can move to different folder and rename the file at the same time. (since I tested success or failed, both gave me NULL.)įor RENAME, it can only rename the file at the same folder. The command does NOT recognize it, which will throw out an error.Ģ. Since your filename: 'TradeDetail04-02-08 00_00_00.txt' has a space. txt TradeDetail.txt'īut when I execute it there are two rows in the result:ġ) The syntax of the command is incorrect.ĭoes anyone know how to accomplish this without using xp_cmdshell? Or may be the right syntax to do it?ġ. I tried simply renaming one of the files using xp_cmdshell:ĮXEC master.xp_cmdshell 'RENAME C:\Webservices\datasource\TradeDetail04-02-08 00_00_00. The original filename(with timestamp) changes daily with a new timestamp but the final file name remains the same ('Trade Detail') txt) and I need to remove the timestamp so that the filename becomes 'TradeDetail'. I need to copy a timestamped file to a different folder and rename it(remove the timestamp) and finally delete the original file.įirstly, I need to copy the file located in the folder (C:\Webservices\datasource ) to (C:\Staging)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |