title: How to rename file without changing the modified date
body: <p>I wrote a script to rename files. But I found the modified date were changed to same. So the original order is broken if they are sorted by date. Is there any way to change the names without changing the modified date? Or although the dates are changed, the order is still the same if they are sorted by date. The following is my current code:</p>
  
  <pre><code># save previous working folder
  wkdir &lt;- getwd()
  
  # set the target folder
  setwd("C:/Users/YY/Desktop/Tmp file/")
  
  # set the file pattern
  a &lt;- list.files(path = ".", pattern = "abc_*.*$") 
  
  # set the name to be replaced
  b&lt;-gsub("abc_","ABC_",a)
  
  # rename
  file.rename(a,b)
  
  # restore previous working folder
  setwd(wkdir)
  </code></pre>
  
  <p>I would appreciate it if anyone can help me.</p>