开发者

Trying to list files/folders WITHOUT a specific directory

开发者 https://www.devze.com 2023-02-10 09:56 出处:网络
I\'m trying to get a file and directory listing for a web site I inherited.I opened a Windows command prompt (I\'m using Windows 7) and entered the following command:

I'm trying to get a file and directory listing for a web site I inherited. I opened a Windows command prompt (I'm using Windows 7) and entered the following command: dir /o:gn /s > filename.txt.

For the most part, it does what I wa开发者_Go百科nt. HOWEVER, it also includes the annoying _notes directories that DreamWeaver leaves behind -- which I DON'T want!!!!!!!

I have to slog through thousands of files and directories, and I could care less about the _notes directories (or anything in them). Editing my results is going to take way too long, and I don't have time to do that.

Is there any way to supress specific files/directories from a DIR command?


Personally, I'd just do it like this:

for /R %f in (*) do @echo %f >> allfiles.txt
grep -v \\_notes\\ allfiles.txt > files.txt

If you don't have grep then you should get it and learn how to use it. I recommend the version from GnuWin32.


Alternatively, when you export the list of files use a vim macro to remove the directories you do not want. Something like (I did not test this): qq/_notes^Mddq@q

note: replace ^M with the Enter key

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号