0

I was wondering how I could go about doing the following (in Windows)

I need to examine the total number of characters in the full path to everything in c:\directory and all subdirectories. Here is the command I was using:

dir /b /s c:\directory\ > output.csv

/B Uses bare format (no heading information or summary).

/S Displays files in specified directory and all subdirectories.

The issue is that c:\directory is a SVN checkout and has a ton of .svn-base files that i do not want to see in the output.csv file. How do I go about filtering output from DIR so I do not see any of these .svn or .svn-base files in output.csv that I am piping the output to?

I tried to use Excel to search the first column in output.csv to select any rows that contain 'svn', but this csv file has well over 30,000 rows in it and that might take awhile to filter everything out if I do it that way.

Is there something similar to grep for windows that I can use to accomplish this? I downloaded grep GNUWin32 but when I try to use it I get some error about a missing library file.

I also have tried to use the /A-H switch in DIR and for whatever reason I still get the .svn folders in each subdirectory :( It very well could be I am not using the switch to not show hidden files correctly..

  • What version of windows – EBGreen Oct 31 '12 at 20:12
1

In a cmd prompt, this should do it:

dir /b /s c:\directory\ | Findstr /V /I .svn > output.csv

If you are on Windows 7/8 or you have installed Powershell, I would suggest learning it. In Powershell you would do something like:

Get-ChildItem . -exclude *.svn -recurse | Select-Object Name | Export-CSV .\output.csv -NoTypeInformation
  • I forgot all about findstr! you rock! thanks! – Richie086 Oct 31 '12 at 20:22
0

Alternative solution (for the cost of size)

Before dir svn export WC into export-dir and eliminate this way .svn dir(s)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.