I have a command line which copies files from folder A to folder B:
copy A\* B\
I would now like to delete all files in B that are present in A, non-recursively. I can list the files in A like this:
dir /b /a-d A
With the output being:
f0.txt
f1.txt
f2.txt
Here is the pseudocode for what I would like to do:
foreach $1 in <dir /b /a-d A output>:
del B\$1
Is there a windows command-line syntax that will execute a command, using the output of another command as an input? I am aware of the piping operator ( | ) but do not know of a way that this could be used to accomplish this task. Any help would be appreciate.
Restriction: Only commands available by default in Windows 7.