Export All Folders Content in a Lists

Hi All,

I have a folder which contains many sub folders with music files contained within them. I'm looking for a way to extract all the contents of that folder into a txt file or similar list.

A bit of a background history behind my request. A colleague of mine has had his PC attacked by that terrible cryptolocker virus. It has since encrypted most of the contents of the Music folder. By having a list of the contents, I could then see what was actually encrypted and removed them. Keeping the non encrypted items. there are hundreds of folders and not wanting to go into them manually to check.

Any solution or other advice sure are welcome :)

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Subash SundharanIT Infrastructure Architect Commented:
Run the following command from Powershell (replace c:\music with your music folder path) will help you to export the filenames and their folder path to a csv file. You can open the csv file in excel to work on it..
GCI C:\Music -Recurse | Select Name,PSParentPath | Export-csv C:\report.csv -nti

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bill PrewIT / Software Engineering ConsultantCommented:
At a plain DOS command prompt, you can do the following to get the full list of files in a folder, including subfolders, and save the output to a file:

dir /s /b /a-d c:\temp\*.* > c:\reports\list.txt

Bill PrewIT / Software Engineering ConsultantCommented:
Just curious, armed with this list of files, how are you intending to determine if a file has been encrypted of not?

If these are MP3 files, I seem to recall some utilities that can validate that a file is a valid MP3 file, but don't have them offhand.  Can try and dig deeper if needed, but wondering if you have some other technique?

Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

N00b2015Author Commented:
Hi BIll,

The files that are encrypted have a *.ENCRYPTED filename extension. How the virus works, is that it deletes the original and replaces it with this file. Craft to say the least!

Thanks all for your prompt replies (subsun too), I will test and let you know.
N00b2015Author Commented:
Dear both,

I've tried both scripts. However, they are both exporting 0kb files with no data.

The cmd command creates the text file but then states "file not found"

The PS script just exports to csv with  a 0kb file.

I'm not sure if its reading all the subfolders?

Any ideas?
N00b2015Author Commented:
Ignore me, Subsun script worked. I had to point it to the main root.

Bill, for some reason it didn't pull all the folders from the directory. Only a few.
Bill PrewIT / Software Engineering ConsultantCommented:
Check the attributes of the folders, either via Windows Explorer, or the ATTRIB command line command, and make sure the folders haven't been marked as HIDDEN or SYSTEM, etc.  Or perhaps the files themselves have been?

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 7

From novice to tech pro — start learning today.