Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have the following command:

find Acc*\bin\Debug\*.pdb > temp.txt

Looking in temp.txt, I have:

Accounting/bin/Debug/Accounting.pdb
Accounting/bin/Debug/BackendProcess.pdb

Note the forward slashes. Why does it output file names like this? And how do I get it to output backslashes, so I can use del on those files?

share|improve this question

migrated from stackoverflow.com Jun 7 '10 at 9:35

This question came from our site for professional and enthusiast programmers.

4 Answers 4

find looks for a search string in files. Perhaps you are looking for something like dir *.pdb /S /B > temp.txt instead?

share|improve this answer

I think you used some sort of port for find(1) on DOS. if you have find, i think you may also have sed as well.. and then...

find condition | sed 's/\//\/g'

this should do the job.

otherwise, follow what @Johannes Rössel said.

share|improve this answer
1  
Ah, right. Should have thought of sed(1). In any case, a port that imposes UNIX filename semantics on foreign OSes is not really worth using, imho. –  Joey Jun 7 '10 at 12:52
    
It's the standard cygwin port, and both semantics are used by Windows in most places. –  OmnipotentEntity Jun 23 '12 at 9:11

I'm looking to list the files with the wildcards I mentioned. Dir cannot do that. Find works fine if the output is in the console:

find Acc*\bin\Debug\*.pdb

will output

Accounting\bin\Debug\Accounting.pdb
Accounting\bin\Debug\BackendProcess.pd

It's just the file redirection that goes wrong.

share|improve this answer
    
When clarifying your question, please use the "edit" link on the question. Don't post an answer to clarify the question. –  T.J. Crowder Jun 7 '10 at 10:19

It looks like you use a poor port of the UNIX find(1) command and not the (formerly-DOS) find utility. Since you apparently have those tools on your machine anyway you can just use rm(1) instead of del on those files.

Another option is to iterate over the output and replace the virgule by a backslash (assuming a batch file here):

setlocal enableextensions enabledelayedexpansion
for /f "delims=" %%x in ('find Acc*\bin\Debug\*.pdb') do (
    set fn=%%x
    set fn=!fn:/=\!
    >>temp.txt echo.!fn!
)
share|improve this answer
    
Short note on why rm works: The Windows API usually has no problems with forward slashes instead of backslashes. However, the built-in commands in cmd do have problems. Since del is a shell built-in and rm is not, it works with rm even with forward slashes. –  Joey Jun 7 '10 at 12:54
    
You were right, I had some unix tools installed, and rm worked. Thank you very much. –  mihai Jan 7 '11 at 17:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.