Reputation: 145
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.
Upvotes: 3
Views: 2924
Reputation: 70923
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.
Upvotes: 4