Jump to content

How list all non-empty subfolders in a folder ?


Recommended Posts

Guest MoiMeme
Posted

Hi,

 

I have a folder with a complex sub-sub-folders structure

 

I need to know wich ones are NOT empty

 

Any way either using DOS or script ?

 

TIA !!!

  • Replies 5
  • Created
  • Last Reply
Guest Pegasus \(MVP\)
Posted

Re: How list all non-empty subfolders in a folder ?

 

 

"MoiMeme" <antispam@no.spam> wrote in message

news:%23tao$9IeIHA.5856@TK2MSFTNGP05.phx.gbl...

> Hi,

>

> I have a folder with a complex sub-sub-folders structure

>

> I need to know wich ones are NOT empty

>

> Any way either using DOS or script ?

>

> TIA !!!

 

Do you consider a folder empty if it contains no files but other folders?

Guest MoiMeme
Posted

Re: How list all non-empty subfolders in a folder ?

 

yes, in this particular case, since I need to know if some of these

subfolders contain files, so I can save them and delete the structure.

But being that complex, it involves much clicking to manually check all of

them

 

"Pegasus (MVP)" <I.can@fly.com.oz> a écrit dans le message de news:

%23IXdwRJeIHA.1824@TK2MSFTNGP02.phx.gbl...

>

> "MoiMeme" <antispam@no.spam> wrote in message

> news:%23tao$9IeIHA.5856@TK2MSFTNGP05.phx.gbl...

>> Hi,

>>

>> I have a folder with a complex sub-sub-folders structure

>>

>> I need to know wich ones are NOT empty

>>

>> Any way either using DOS or script ?

>>

>> TIA !!!

>

> Do you consider a folder empty if it contains no files but other folders?

>

>

>

Guest Pegasus \(MVP\)
Posted

Re: How list all non-empty subfolders in a folder ?

 

Your reply is contradictory. I asked:

"Do you consider a folder empty if it contains no files but other folders?"

 

and you replied:

"Yes".

 

Then you imply that you DON'T consider them empty, because

they might contain files. Before I try to give you a solution

I need to know in no uncertain terms the answer to my

question.

 

 

 

"MoiMeme" <antispam@no.spam> wrote in message

news:ejkNF%23WeIHA.2448@TK2MSFTNGP03.phx.gbl...

> yes, in this particular case, since I need to know if some of these

> subfolders contain files, so I can save them and delete the structure.

> But being that complex, it involves much clicking to manually check all of

> them

>

> "Pegasus (MVP)" <I.can@fly.com.oz> a écrit dans le message de news:

> %23IXdwRJeIHA.1824@TK2MSFTNGP02.phx.gbl...

>>

>> "MoiMeme" <antispam@no.spam> wrote in message

>> news:%23tao$9IeIHA.5856@TK2MSFTNGP05.phx.gbl...

>>> Hi,

>>>

>>> I have a folder with a complex sub-sub-folders structure

>>>

>>> I need to know wich ones are NOT empty

>>>

>>> Any way either using DOS or script ?

>>>

>>> TIA !!!

>>

>> Do you consider a folder empty if it contains no files but other folders?

>>

>>

>>

>

>

>

>

>

>

>

>

Guest MoiMeme
Posted

Re: How list all non-empty subfolders in a folder ?

 

Indeed not correctly stated

What I need to detect are folders that do contain files

 

If yes then i have to gather the files it contains

If no files and no subfolders then I can erase the folder

 

 

 

"Pegasus (MVP)" <I.can@fly.com.oz> a écrit dans le message de news:

eY9U8HXeIHA.4144@TK2MSFTNGP05.phx.gbl...

> Your reply is contradictory. I asked:

> "Do you consider a folder empty if it contains no files but other

> folders?"

>

> and you replied:

> "Yes".

>

> Then you imply that you DON'T consider them empty, because

> they might contain files. Before I try to give you a solution

> I need to know in no uncertain terms the answer to my

> question.

>

>

>

> "MoiMeme" <antispam@no.spam> wrote in message

> news:ejkNF%23WeIHA.2448@TK2MSFTNGP03.phx.gbl...

>> yes, in this particular case, since I need to know if some of these

>> subfolders contain files, so I can save them and delete the structure.

>> But being that complex, it involves much clicking to manually check all

>> of

>> them

>>

>> "Pegasus (MVP)" <I.can@fly.com.oz> a écrit dans le message de news:

>> %23IXdwRJeIHA.1824@TK2MSFTNGP02.phx.gbl...

>>>

>>> "MoiMeme" <antispam@no.spam> wrote in message

>>> news:%23tao$9IeIHA.5856@TK2MSFTNGP05.phx.gbl...

>>>> Hi,

>>>>

>>>> I have a folder with a complex sub-sub-folders structure

>>>>

>>>> I need to know wich ones are NOT empty

>>>>

>>>> Any way either using DOS or script ?

>>>>

>>>> TIA !!!

>>>

>>> Do you consider a folder empty if it contains no files but other

>>> folders?

>>>

>>>

>>>

>>

>>

>>

>>

>>

>>

>>

>>

>

>

Guest Pegasus \(MVP\)
Posted

Re: How list all non-empty subfolders in a folder ?

 

You could run the following batch file. Make sure to copy

& paste it - do NOT retype it!

 

==============================

@echo off

Set Folder=D:\My Documents

 

rem Unwrap the lines below so that they

rem all start with the word "echo"!

 

echo Empty folder list:

echo > c:\TempVBS.vbs const FolderName = "%Folder%"

echo >> c:\TempVBS.vbs Set objFSO =

CreateObject("Scripting.FileSystemObject")

echo >> c:\TempVBS.vbs CheckFolder(FolderName)

echo >> c:\TempVBS.vbs Sub CheckFolder(Name)

echo >> c:\TempVBS.vbs Set folder = objFSO.GetFolder(Name)

echo >> c:\TempVBS.vbs Set objFolders = folder.SubFolders

echo >> c:\TempVBS.vbs Set objFiles = folder.Files

echo >> c:\TempVBS.vbs If objFolders.Count + objFiles.Count = 0 Then

WScript.Echo Name

echo >> c:\TempVBS.vbs For Each FldrName In objFolders

echo >> c:\TempVBS.vbs CheckFolder(FldrName)

echo >> c:\TempVBS.vbs Next

echo >> c:\TempVBS.vbs End Sub

 

rem The lines below this point do NOT start

rem with the word "echo"!

cscript //nologo c:\TempVBS.vbs

del c:\TempVBS.vbs

 

==============================

 

"MoiMeme" <antispam@no.spam> wrote in message

news:ed8xRTXeIHA.5208@TK2MSFTNGP04.phx.gbl...

> Indeed not correctly stated

> What I need to detect are folders that do contain files

>

> If yes then i have to gather the files it contains

> If no files and no subfolders then I can erase the folder

>

>

>

> "Pegasus (MVP)" <I.can@fly.com.oz> a écrit dans le message de news:

> eY9U8HXeIHA.4144@TK2MSFTNGP05.phx.gbl...

>> Your reply is contradictory. I asked:

>> "Do you consider a folder empty if it contains no files but other

>> folders?"

>>

>> and you replied:

>> "Yes".

>>

>> Then you imply that you DON'T consider them empty, because

>> they might contain files. Before I try to give you a solution

>> I need to know in no uncertain terms the answer to my

>> question.

>>

>>

>>

>> "MoiMeme" <antispam@no.spam> wrote in message

>> news:ejkNF%23WeIHA.2448@TK2MSFTNGP03.phx.gbl...

>>> yes, in this particular case, since I need to know if some of these

>>> subfolders contain files, so I can save them and delete the structure.

>>> But being that complex, it involves much clicking to manually check all

>>> of

>>> them

>>>

>>> "Pegasus (MVP)" <I.can@fly.com.oz> a écrit dans le message de news:

>>> %23IXdwRJeIHA.1824@TK2MSFTNGP02.phx.gbl...

>>>>

>>>> "MoiMeme" <antispam@no.spam> wrote in message

>>>> news:%23tao$9IeIHA.5856@TK2MSFTNGP05.phx.gbl...

>>>>> Hi,

>>>>>

>>>>> I have a folder with a complex sub-sub-folders structure

>>>>>

>>>>> I need to know wich ones are NOT empty

>>>>>

>>>>> Any way either using DOS or script ?

>>>>>

>>>>> TIA !!!

>>>>

>>>> Do you consider a folder empty if it contains no files but other

>>>> folders?

>>>>

>>>>

>>>>

>>>

>>>

>>>

>>>

>>>

>>>

>>>

>>>

>>

>>

>

>

>

>

>


×
×
  • Create New...