Wednesday 19 February 2014

Using batch file tricks Part 1 [ list all file names from current directory]

List all filenames from your current directory

How to do this ?

First step

Open a notepad

Step Two

copy paste this code

       

dir /b >> list.txt
        
    


then save it as "mamstricks.bat"

Step Three

Double click on "mamstricks.bat"

Now You can see like this



A new file named list.txt is created automatically now open that list file


Now test these codes too

 if I want all the all  files in the current directory and subdirectories with their full paths, I can do


dir *.* /b /s >> list.txt


dir *.* /A-D >> list.txt

Now we can change *.* →*.txt
 to list all text file
or *.jpg
to list jpg files etc

Now note that
  • >> appends
  • > creates new or overwrites existing

Advantages and Application

Suppose that you may need some file ,but you have no idea about its name or you forgot that but ,the name may  be remember when you see that file, in such case you can use this techniques and can search that file from a single notepad by scrolling the lines
if you want to analyse some files in your directory, it takes a long time to open each folder then scrolling each directory then going back to same directory and soon.  it may contains lots of sub or sub sub directories etc.

0 Comments:

Post a Comment

Facebook Twitter Delicious Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | coupon codes