i am trying to delete files created by this command cleartool ls -r -view_only
The output looks like .\noc\shared\dpcversioninfo.rc.keep
I want to pipe this into a del command like cleartool ls -r -view_only|del /q and get bad syntax.
del command does not read data from stdin. You will need to retrieve the output of the cleartool command and use it as argument to del
The way to do it in windows is to use a for /f command. It can execute a command and iterate over its output lines, executing the code after the do clause for each of them, with the contents of the line stored in the indicated replaceable parameter (the for variable)
@echo off
setlocal enableextensions disabledelayedexpansion
for /f "delims=" %%a in ('cleartool ls -r -view_only') do echo del /q "%%a"
This will echo to console the del commands. If the output is correct, remove the echo command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With