Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Renaming Windows directory using Stata syntax?

    Dear Statalist

    Is there a way to rename directories on my Windows PC from within Stata? I found how to rename files and how to erase files and how to make directories, but is there no command that lets me rename an existing directory. I'm using Stata 13 and Windows 10.

    Thank you very much for your consideration
    K

  • #2
    Here is how you want to rename c:\foo to c:\bar

    Code:
    !ren c:\foo bar
    Note that Windows insists on the backslash (which is best not be used otherwise).

    Best
    Daniel

    Comment


    • #3
      Great, thanks!

      Somehow this doesn't work for me, because my situation is more like

      Code:
      cd "C:\Dropbox\Super\complicated\path\"
      !ren foo bar
      and in that situation, "!ren foo bar" doesn't do anything. Is there a way around that?

      Thank you
      K

      Comment


      • #4
        instead of the command that "doesn't do anything" put a command shell. This will shell out to the command line. There manually type ren foo bar and see what the error message will be. Let us know.

        Comment


        • #5
          Thank you very much, Sergiy, that's the information I needed. I found out that "doesn't do anything" was because of "The process cannot access the file because it is being used by another process." and after ending that process, Daniel's solution works.

          All the best
          Klaus Steitzel

          Comment

          Working...
          X