Tuesday, 28 July 2015

How To List Movies or Any Other Files On Your Computer

There are times when we want to sort the list of files on our hard drive. Sometimes there will be a large number of files, like movies, songs or documents and we have very little time to go through the folders to see what is where.. this can be very much time consuming if you are looking to list them all for reference or trying to find on which folder a file is.

Today, I'm going to show you how you can easily create lists of :

  1. sub-folders of a folder
  2. files in a folder and its sub-subfolders
  3. files of particular file type in a folder and its sub-folders. 

The list will be generated on a text file and you can easily see where each file/folder is located on your hard drive.

1. See all the sub-folders of a particular folder

Open notepad and type the code highlighted below

 dir /a-d /s /b *. >allfolders.txt (please note that there's a space before dir)

save it as gen_all.bat 

Make sure you have selected "Save as type" as "All Files" as shown below

Now go to the folder/location where you saved the .bat file and double click it. It will open command prompt and a new text file is created (allfolders.txt). Now, open the text file and you can see the list of sub-folders of that location/folder.

2. See all the files in a folder and its sub - folders

Okay, so it is that simple to list sub-folders. Now let's see how to list the files. Open notepad again and copy the following text and save it as gen_files.bat 

 dir /a-d /s /b *.* >allfiles.txt 

Then save it just like you saved the first time, as show in the image. Now if you double click the .bat file, it will generate a text file (allfiles.txt) with the list of each and every file in that folder and its sub-folders. It will show where each file is located as shown below.

3. See all the files of a particular filetype or extension in a folder and its sub-folders

Now, this is the most useful part. Let's say, you need the list all movies on your movies folder or songs on your music folder. You know the extensions of movies and videos are mostly .avi, .mkv, .mp4, documents can be .doc, docx, .xls, or .pdf and music files are .mp3, .wav etc. So we make .bat file for whatever type of file we need. The code can be written as :

 dir /a-d /s /b *.filetype >myfile.txt 

Here .filetype can be replaced with whatever extension you want, like .mp3, .avi etc

You can also choose to list files with many extensions in a single text file. For example the below code will list most of the movie files.

 dir /a-d /s /b *.mkv, *.avi, *.mp4, *.mov, *.wma, *.flv >movies.txt 

You will get all the movies on that folder and sub-folders listed on movies.txt as shown below:

Remember, just create a bunch of .bat files for various extensions and keep them all in a folder. Whenever you want to create a list, copy the appropriate .bat file to the folder you are trying to sort. And run to get the list! It is that simple :)

NB: To run .bat files in C drive or wherever you have installed Windows, you need administrator privileges. All these instructions work on command prompt and on linux terminal too. 

I find these very useful when I have a large number of files to sort and I hope it helps you too. If you liked it, please share :)

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...