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!
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!
Comment