Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Create txt file of folder contents

02 Mar 2014   #1
xxxdannyxxx

Windows 7 Home Premium x64 SP1
 
 
Create txt file of folder contents

Hi Guys long time no see, hope you are all well

I want to create an index of movies on a NAS drive.
I have a folder G:\Shared Videos on a NAS which has 23 sub folders inside (Film Genres) and a total of 1100 .Mp4 movies spread across these folders. I need a .bat file I can run from inside G:\Shared Videos that will list the 1100 movies, name only (not the Genre Folders or location) in alphabetical order to a text file I can then import to excel to create an Index. Is this possible. I've tried a few I have found searching but there not quite doing what I want.

Danny


My System SpecsSystem Spec
.
02 Mar 2014   #2
RealPetChicken

Windows Seven Ultimate x64 SP1
 
 

My System SpecsSystem Spec
02 Mar 2014   #3
xxxdannyxxx

Windows 7 Home Premium x64 SP1
 
 

Yes tried it Thanks. that copies the whole path I only want the file names

I have got as far as this but this is only copying the 23 folder names in the public folder to a .txt file which means I would have to run the .bat in all 23 folders and then organise them alphabetically. I need it to omit the folders and list the .Mp4s in the folders only

Code:
dir /a /b /-p /o:gen >C:\WINDOWS\Temp\file_list.txt
start notepad C:\WINDOWS\Temp\file_list.txt
My System SpecsSystem Spec
.

02 Mar 2014   #4
MilesAhead

Windows 7 32 bit
 
 

Try this ahk script. Instead of using notepad I suggest free EditPad Lite 7. It has sorting and duplicate line elimination.

To use the script, compile to exe and copy the exe to the root folder. Open command prompt tp root folder and type GetMovieNames.exe. I suggest erasing your text file first as this appends to it.

Code:
SendMode Input
SetWorkingDir %A_ScriptDir%


Loop,%A_WorkingDir%,2,1
    Run %comspec% /c  "dir /a /b /-p /o:gen >>C:\WINDOWS\Temp\file_list.txt"
You can download AutoHotkey_L here
AutoHotkey Downloads

There are forums. You can post the script and ask for help embellishing it. For example deleting the results file on start and filtering out the folder names etc..

Edit: It's worth messing around with ahk since you can make your own hotkey tray utilities to do just about anything when you press a key combination.

Edit2: ahk and the forums are free. An online email like hotmail or outlook is fine for free registration to the forums.
My System SpecsSystem Spec
02 Mar 2014   #5
xxxdannyxxx

Windows 7 Home Premium x64 SP1
 
 

Quote   Quote: Originally Posted by MilesAhead View Post
Try this ahk script. Instead of using notepad I suggest free EditPad Lite 7. It has sorting and duplicate line elimination.

To use the script, compile to exe and copy the exe to the root folder. Open command prompt tp root folder and type GetMovieNames.exe. I suggest erasing your text file first as this appends to it.

Code:
SendMode Input
SetWorkingDir %A_ScriptDir%


Loop,%A_WorkingDir%,2,1
    Run %comspec% /c  "dir /a /b /-p /o:gen >>C:\WINDOWS\Temp\file_list.txt"
You can download AutoHotkey_L here
AutoHotkey Downloads

There are forums. You can post the script and ask for help embellishing it. For example deleting the results file on start and filtering out the folder names etc..

Edit: It's worth messing around with ahk since you can make your own hotkey tray utilities to do just about anything when you press a key combination.

Edit2: ahk and the forums are free. An online email like hotmail or outlook is fine for free registration to the forums.
Thanks Miles will give it a go, one question why the >> oppose to my single
My System SpecsSystem Spec
02 Mar 2014   #6
Callender

Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
 
 
Movie file names to .csv?

Hi,

I must confess that I cannot write a script for you but I have another solution that works for me.

I have installed Saleen Video Manager as a portable app and it stores videos that are added to the library in an Access Database (.mdb format).

Create txt file of folder contents-videomanag-4.jpg

It's possible to open this database using any software that can open and view .mdb files.

It's then possible to choose columns and sort by path or alphabetically and export to .csv.

You'd only need to sort by path if you added more than one directory to the library.

Create txt file of folder contents-videomanag-3.jpg

Here's a screenshot of part of an exported list of files in .mdb and .csv formats/ views.

Create txt file of folder contents-videomanag.jpg


Attached Images
Create txt file of folder contents-videomanag-2.jpg 
My System SpecsSystem Spec
02 Mar 2014   #7
xxxdannyxxx

Windows 7 Home Premium x64 SP1
 
 

Got it in the end was missing the s switch. Anyone needs it copy to notepad and save as .bat and run from the directory you want the list of files for

Code:
dir /a:-d /b /s /o:n >C:\WINDOWS\Temp\file_list.txt
start notepad C:\WINDOWS\Temp\file_list.txt
Cheers Guys

Danny
My System SpecsSystem Spec
02 Mar 2014   #8
MilesAhead

Windows 7 32 bit
 
 

The >> is append to file. The > will overwrite the file.

Also if they are all the same file type such as .mp4 use dir *.mp4 /s instead of just dir /s
My System SpecsSystem Spec
02 Mar 2014   #9
xxxdannyxxx

Windows 7 Home Premium x64 SP1
 
 

Thanks Miles any way to get the list without the file path just the Mp4 name
My System SpecsSystem Spec
02 Mar 2014   #10
MilesAhead

Windows 7 32 bit
 
 

See if this works

Code:
SendMode Input
SetWorkingDir %A_ScriptDir%
ResultFile := "C:\WINDOWS\Temp\file_list.txt"

Loop,*.mp4,,1
    FileAppend,%A_LoopFlename%`n,%ResultFile%
Edit: I added the "`n" to the "%A_LoopFlename%" in the script so it should write one name per line to the text file.

Edit2: I haven't tested it. Should be simple enough but you never know. If it doesn't work as expected post and I'll try to fix it up.
My System SpecsSystem Spec
Reply

 Create txt file of folder contents




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
How to create a current date folder using batch file?
Hi I am using following batch file for cleaning the desktop and also for taking backup of desktop: @echo off set curr_date=%DATE:~10,4%-%DATE:~4,2%-%DATE:~7,2% mkdir "%USERPROFILE%\My Documents\backup\%curr_date%_backup"
General Discussion
why cant we create CON folder/file ???
why cant we create CON folder/file ??? for what it refers to ??? plz share ur views... :sarc:
General Discussion
Batch file to create a folder with name of the time.
I'm trying to write a batch file that when run creates a folder named "Backup" followed by the time it was created, and then copies files to that folder. When I run md "C:\Users\MasterControlProgram\Documents\MC Server With Backup\Backups\Backup %DATE%\" xcopy /e /v /y...
Backup and Restore
Batch file to move (many) duplicted folder contents - Help!!
Hope I can explain my difficulty. I have duplicated folders album name for all my music files. As there is quite a considerable number I wondered if it was possible to batch file (automate) the process. I can not delete "d" as this would delete all the tracks. What I need to do is move the...
General Discussion
How do I create file and folder pairs in Windows?
Is there a way to group some folder and files together so that when I move one of them, they all get moved to a new location together?
General Discussion
How to create a file in a folder?
I usually hang around fora dealing with antique farm equipment and always feels sorry for the guy who asks how to adjust the main jet on a Farmall H carb and two out of three responders tell him how to use the Search function. So I've spent a day or two worth of spare time searching through the...
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 09:55.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App