Re: How to find dirs with single item
On Fri, May 30, 2014 at 9:20 PM, Marko Randjelovic <markoran@eunet.rs> wrote:
>> Can you try the Python script on that, please? File system encodings
>> can be a bit of a pain at times. If it doesn't work as "python", try
>> "python3", as the two are a bit different as regards Unicode.
>>
>> ChrisA
>>
>>
>
> No problem, but please give me the python code to execute.
The few lines I posted previously:
import os
for root, dirs, files in os.walk('.'):
if len(dirs + files) == 1: print(root)
Save those to a file, run that. It should print out, one per line, the
names of directories with just one file or subdir; but I don't know
how it'll go with different FS encodings.
ChrisA
Reply to: