Announcement

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

  • Remove-Item : A positional parameter cannot be found that accepts argument '/s'.

    Moderators: I don't believe this is cross-posting, but a re-posting into a new thread because I feel like the title of the initial thread was not accurate enough for this issue.
    The original post was here: https://www.statalist.org/forums/for...49#post1729749


    Hello all,
    This is a question related to -rmdir- command.
    I'm trying to empty out all of the files from a folder before populating the same folder with new files (the files are created as part of a foreach loop). Historically, I've done this by deleting the folder using -rmdir- and then recreating the folder by using -mkdir- .

    Sometime in the past two weeks, the -rmdir- has stopped working. When I run this code:

    !rmdir "D:\MyDocs\StataUserFiles\Projects\BPAinSTATA\ do_f ile_stages\Stage5\DTAfiles" /s /q


    STATA produces the following comments:

    Remove-Item : A positional parameter cannot be found that accepts argument '/s'.
    At line:1 char:1
    + rmdir D:\MyDocs\StataUserFiles\Projects\BPAinSTATA\do_fi le_stages\Sta ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: ( [Remove-Item], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.C ommands.RemoveItemCommand



    I am using version 18, but have also gone back and set the version to 17.0 and the same comments appear.
    I've checked the directory path several times, including copying and pasting the directory path to avoid typos. No help.
    I cannot find anything on "Remove-Item."

    I presume I'm missing something obvious.
    Any ideas?
    Thank you!
    Last edited by James Voss; 12 Oct 2023, 14:28.

  • #2
    When you type

    Code:
    !rmdir
    you are not using Stata's rmdir command; you are using Stata's shell command and instructing Windows to remove a folder. The problem is probably with (Microsoft) Windows more than with Stata.

    Comment


    • #3
      Right, sorry for the mis-statement and thanks for the correction.
      A problem with Window. Ugh. thanks. I'll contact my IT division. Any ideas on where to suggest they should start to debug?

      Comment

      Working...
      X