Thursday, June 23, 2011

Screenshot vs Directory Listing

It really frustrates me that most people insist on giving me a screen grab when I asked for a directory listing, even worse is that it ends up being a distorted shrunk jpg of everything they had open at the time. So I decided to wright this post to address both of those issues.

Screen Capture
You can take a picture of what is on your screen by pressing PRINT SCREEN (PRTSC or PRTSCN on some keyboards). This is called a screen capture. You can then paste the screen capture into a document, e‑mail message, or other file. - Microsoft Windows

There are two types of screen captures you can take:
1.      To copy the entire screen
o   Press the 'PRINT SCREEN' button.

2.      To copy only an active window
o   Press both 'ALT' & 'PRINT SCREEN'.
Note: An active window is the currently focused window.


Directory Listing
Displays a list of a directory's files and subdirectories. Used without parameters, dir displays the disk's volume label and serial number, followed by a list of directories and files on the disk, including their names and the date and time each was last modified.
For files, dir displays the name extension and the size in bytes. Dir also displays the total number of files and directories listed, their cumulative size, and the free space (in bytes) remaining on the disk.

Syntax:
dir[Drive:][Path][FileName][...][/p][/q][/w][/d]
[/a[[:]attributes]]
[/o[[:]SortOrder]]
[/t[[:]TimeField]][/s][/b][/l][/n][/x][/c [/4]
Now this may look overwhelming, but what we need to achieve is not nearly as complex.
  1. Brows to the folder in question.
  2. Create a new text file.
  3. Add the following text "dir *.* > filename.txt" to the file just created.
  4. Save it, Close it & then change the files extension from '.txt' to '.bat'.
  5. Run the bat file.
This will output a text file called filename.txt that contains all the folder information and content.

Output example :
 C:\Users\Public\Pictures\Sample Pictures>'''dir'''
  Volume in drive C is System
  Volume Serial Number is C8D0-76E2
 
  Directory of C:\Users\Public\Pictures\Sample Pictures
 
 14-07-2009  06:41    <DIR>          .
 14-07-2009  06:41    <DIR>          ..
 14-07-2009  06:52           879,394 Chrysanthemum.jpg
 14-07-2009  06:52           845,941 Desert.jpg
 14-07-2009  06:52           595,284 Hydrangeas.jpg
 14-07-2009  06:52           775,702 Jellyfish.jpg
 14-07-2009  06:52           780,831 Koala.jpg
 14-07-2009  06:52           561,276 Lighthouse.jpg
 14-07-2009  06:52           777,835 Penguins.jpg
 14-07-2009  06:52           620,888 Tulips.jpg
                8 File(s)      5,837,151 bytes
                2 Dir(s)  57,925,980,160 bytes free
 
 C:\Users\Public\Pictures\Sample Pictures>'''dir /w'''
  Volume in drive C is System
  Volume Serial Number is C8D0-76E2
 
  Directory of C:\Users\Public\Pictures\Sample Pictures
 
 [.]                 [..]                Chrysanthemum.jpg   Desert.jpg          Hydrangeas.jpg      Jellyfish.jpg
 Koala.jpg           Lighthouse.jpg      Penguins.jpg        Tulips.jpg
                8 File(s)      5,837,151 bytes
                2 Dir(s)  57,925,992,448 bytes free
 
 C:\Users\Public\Pictures\Sample Pictures>
PS. This can obviously be refind using parameters :
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/dir.mspx?mfr=true

No comments:

Post a Comment