dir /s not returning ALL subdirectories

0

I need a list of all files and folders in a giant directory. This ends up being approximately 1000 folders and 20000 files.

Being a command line noob, I started out just by doing "dir>file.txt" while cd-ed to each individual folder.

Now im trying to just do this by using "dir /s>file.txt" on the top level directory.

It looks like the command works properly, and the file gets created, the issue is that the .txt file contains only 19 of the 107 top level directories.

Anyone have any ideas on why the command is crapping out less than a fifth of the way in? Is there some kind of max number of values returned for the command or something?

user2989297

Posted 2015-08-03T20:40:52.427

Reputation: 101

I rarely use CMD, preferring the free TCC/LE from JP Software, and I've never had a problem such as you describe. Maybe you have some very long path lengths in your directory tree, causing a buffer overflow in CMD.

– AFH – 2015-08-03T21:18:48.043

I added the comment about your tag after I had given you relevant information: are you ignoring that? Either of the commands in Keltari's answer will show if you have very long paths. – AFH – 2015-08-03T21:31:17.217

So, with the two of you together, I can use tree, I can use powershell using get-childitem -recurse. I install JP Software so that I could use TCC/LE.

I am pretty sure I could use perl or java. I'm pretty sure I could switch over to linux. I'm pretty sure I could develop a custom application.

None of this tells me the constraints of dir, or how to fix my dir command.

It's like a person asking about repairing the chain on their bicycle and being told how plasma cutters work wonders at clearing debris in jet engines. – user2989297 – 2015-08-03T22:02:42.757

Sorry, just seems like a simple issue that I'm very close to a solution on, and I've been told I'm in the wrong stack exchange forum, I've gotten a bunch of edits to my question, I've been told about all sorts of different development tools but noone who has spoken up knows about what I'm asking, the dir command in the command line. – user2989297 – 2015-08-03T22:04:20.827

I know precisely what you're asking, and I have suggested a reason for your problem and a work-round. If you want the software to work correctly, raise the matter with Microsoft - it's their software. Good luck. – AFH – 2015-08-04T00:01:07.800

I see no reason to delete this; there is an upvoted answer, and there was only one edit changing the tags. – slhck – 2015-08-04T12:32:57.820

Answers

1

I dont know if there are limits for dir

Try the tree command in the command prompt tree /f

If that doesnt work, try using powershell and use get-childitem -recurse

Keltari

Posted 2015-08-03T20:40:52.427

Reputation: 57 019

Thanks but both of those take me away from the formatting I need. – user2989297 – 2015-08-03T20:50:13.483

@user2989297 PowerShell can format it any way you want. get-childitem -recurse | format-list research the format-list command, and you can get the data in any form you want. – Keltari – 2015-08-03T20:52:14.713

Thanks for the info, and first chance I get, I will learn what Powershell is. Unfortunately, atm, I'm "dir" level proficient, and im looking for information on the "dir" command and why it would generate 20% of exactly what I need, and then stop cold. – user2989297 – 2015-08-03T20:55:41.220

0

To include hidden and system files\folders use dir /a /s>file.txt

Ricardo Bohner

Posted 2015-08-03T20:40:52.427

Reputation: 1 256