1.

Solve : How to create .bat files which create filelistings?

Answer»

Hi,

I've got no experience with batch files to speak of and want to create batch files which list the contents of my folders. I've been looking around and found d quite a few examples, some of which I tried with (some) success...I found that some different commands seem to give the same result, and others I recombined which then didn't work the way intended. So I now want to make a list with most or all the relevant commands (\a, \b and so on) and their values or results. I also would like to know if they are freely combinable or not. I've been searching the web but only come up with (sometimes conflicting) bits and pieces and would appreciate any kind of help. Are there any e-books on the subject or is anyone willing to tell me a bit? 

I'm not familiar with DOS or anything, only use Windows and other progs. But I know how to install OS and arm PCs and stuff like that...

Thanks a lot in advance!Use  only one \\  where two appear

C:\\test>type  ch88.bat

echo off

dir *.*  %1

Output:

C:\\test>ch88.bat  c:\\test 
 Volume in drive C has no label.
 Volume Serial Number is 0652-E41D

 Directory of C:\\test

08/08/2010  05:24 PM              .
08/08/2010  05:24 PM              ..
05/27/2010  07:21 PM              !Grants
07/08/2010  02:58 PM                 8 07072010timeclock.csv
07/08/2010  02:58 PM                 8 07082010timeclock.csv
07/25/2010  04:43 PM                14 1.txt
07/25/2010  04:44 PM                14 10.txt
07/25/2010  04:46 PM                14 11.txt
07/25/2010  04:46 PM                14 12.txt
07/25/2010  04:46 PM                14 13.txt
07/25/2010  04:47 PM                14 14.txt
07/25/2010  04:47 PM                14 15.txt
.
.
.Thanks a lot, Victoria

Couldn't do much with it, though...don't understand enough.
I'll post some of the info I have to let you know what it is I'm after:


A list of commands I'd like to complete as much as possible (and, of course, check for errors):

/a                    = read ALL files in folder (a = archivable files)
:d                    = directories only
-d                    = don't list the archive date/time
/s                    = include files from sub-folders
/b                    = exclude unnecessary file information such as filesize and stuff (b = bare names only)
>                     = go to the following folder (sends the output to a file instead of displaying it on the screen)
"...."                 = direction of folder to use
\.mp3               = only list .mp3 files (exclusive command for type of files to list)
:gen                 = generate



And some of the examples I have gathered and tried (but not all successfully):

dir /a /s /-p /o:gen >filelisting.txt

dir /a /b /s /-p /o:gen >filelisting.txt

dir /a /b /s /-p /o:gen >C:\Temp\filelisting.txt
start notepad C:\Temp\filelisting.txt



So, what I wanted was to print a list of all my musicfiles - some 40.000 spread over Alphabetical folders with subfolders for groups and sub-subfolders for their discs. I've managed that, but wanted to clean up the process so I only get the archives names without all the other info (like timestamps and so on)...

Then I wanted to make that command part of the Explorer Context Menu (in Win7 apparently you need programs for that, I tried Context Menu Editor but it doesn't quite work - maybe it's not 64-bit compatible or maybe I need to do sth. differently) so that I can right-click over any folder and have it's contentslist saved in a dedicated folder - and open automatically afterwards...

But, although I'd appreciate a working commandline(s) for that purpose, I now also would like to understand the whole thing a bit better - that's why I'd like a list of commands and so on. Maybe I'm a bit over the top with that one - or it's just not as simple a matter as I imagine it to be and requires proper study. But, anyway....

Thanks a lot again
http://www.robvanderwoude.com/batchcommands.php



C:\\>dir /?
Displays a list of files and subdirectories in a directory.

  /A          Displays files with specified attributes.
  attributes   D  Directories                R  Read-only files
               H  Hidden files               A  Files ready for archiving
               S  System files               I  Not content indexed files
               L  Reparse Points             -  Prefix meaning not
  /B          Uses bare format (no heading information or summary).
  /C          Display the thousand separator in file sizes.  This is the
              default.  Use /-C to disable display of separator.
  /D          Same as wide but files are list sorted by column.
  /L          Uses lowercase.
  /N          New long list format where filenames are on the far right.
  /O          List by files in sorted order.
  sortorder    N  By name (alphabetic)       S  By size (SMALLEST first)
               E  By extension (alphabetic)  D  By date/time (oldest first)
               G  Group directories first    -  Prefix to reverse order
Press any key to continue . . .



C:\\>dir /AD  /w
 Volume in drive C has no label.
 Volume Serial Number is 0652-E41D

 Directory of C:\\

[$Recycle.Bin]              [06-07-2010]                [1]                         [1100]                      [20100419]
[backup]                    [BILL-PC]                   [bin]                       [destfiles]                 [Documents and Settings]
[LaserJet517]               [logs]                      [MSOCache]                  [Office2003SP3Changes]      [PerfLogs]
[prison]                    [PROGRAM Files]             [ProgramData]               [RECENTBKUP]                [Recovery]
[System Volume Information] [temp]                      [test]                      [tmp]                       [Users]
[Windows]                   [zz]
               0 File(s)              0 bytes
              27 Dir(s)  293,475,434,496 bytes free

C:\\>

google  .wav  extention
C:\\>dir  /s  *.wav  |  more
 Volume in drive C has no label.
 Volume Serial Number is 0652-E41D

 Directory of C:\\Program Files\\Microsoft Office\\MEDIA\\CAGCAT10

03/10/1998  09:02 PM            22,618 ELPHRG01.WAV
02/16/1999  09:50 PM            26,810 J0214098.WAV
               2 File(s)         49,428 bytes

 Directory of C:\\Program Files\\Microsoft Office\\OFFICE11

02/19/2003  01:05 PM           108,800 REMINDER.WAV
               1 File(s)        108,800 bytes

 Directory of C:\\Windows\\Installer\\$PatchCache$\\Managed\\9040211900063D11C

02/19/2003  01:05 PM           108,800 REMINDER.WAV
               1 File(s)        108,800 bytes

 Directory of C:\\Windows\\Media

06/10/2009  04:22 PM           216,364 chimes.wav
06/10/2009  04:22 PM           113,964 chord.wav
06/10/2009  04:22 PM            70,060 ding.wav
06/10/2009  04:24 PM           118,060 ir_begin.wav
06/10/2009  04:24 PM           126,252 ir_end.wav
06/10/2009  04:24 PM           178,732 ir_inter.wav
06/10/2009  04:22 PM           228,396 notify.wav
06/10/2009  04:22 PM           111,788 recycle.wav
06/10/2009  04:22 PM            88,236 ringout.wav
06/10/2009  04:37 PM           153,644 Speech Disambiguation.wav
06/10/2009  04:37 PM            71,212 Speech Misrecognition.wav
06/10/2009  04:37 PM           188,460 Speech Off.wav
06/10/2009  04:37 PM           147,500 Speech On.wav
06/10/2009  04:37 PM           128,812 Speech Sleep.wav
06/10/2009  04:22 PM           285,228 tada.wav
06/10/2009  04:22 PM           178,220 Windows Balloon.wavHey,
Thanks a lot, Victoria, for your help!
I'll need to get some sleep now - gotta organize my employees tomorrow early on - but will follow up all your info as soon as I can.
I'll post another reply after to let you know!

ManasaOK, Victoria -

I'm still quite busy with work and stuff - so I haven't tried anything yet. But your list has been usefull, as well as the link you posted. I think that I will simply have to get some e-book or tutorial and learn the stuff from scratch.
Given that I started something (albeit nothing important, really) I just don't like not understanding what I'm doing.

Thanks again for your help
C:>help
For more information on a specific command, type HELP command-name
ASSOC          Displays or modifies file extension associations.
ATTRIB         Displays or changes file attributes.
BREAK          Sets or clears extended CTRL+C checking.
BCDEDIT        Sets properties in boot database to control boot loading.
CACLS          Displays or modifies access control lists (ACLs) of files.
CALL           Calls one batch program from another.
CD             Displays the name of or changes the current directory.
CHCP           Displays or sets the active code PAGE number.
CHDIR          Displays the name of or changes the current directory.
CHKDSK         Checks a disk and displays a status report.
CHKNTFS        Displays or modifies the checking of disk at boot time.
CLS            Clears the screen.
CMD            Starts a new instance of the Windows command interpreter.
COLOR          Sets the default console foreground and background colors.
COMP           Compares the contents of two files or sets of files.
COMPACT        Displays or alters the compression of files on NTFS partitions.
CONVERT        Converts FAT volumes to NTFS.  You cannot convert the
               current drive.
COPY           Copies one or more files to another location.
DATE           Displays or sets the date.
DEL            Deletes one or more files.
DIR            Displays a list of files and subdirectories in a directory.
DISKCOMP       Compares the contents of two floppy disks.
DISKCOPY       Copies the contents of one floppy disk to another.
DISKPART       Displays or configures Disk Partition properties.
DOSKEY         Edits command LINES, recalls Windows commands, and
               creates macros.
DRIVERQUERY    Displays current device driver status and properties.
ECHO           Displays messages, or turns command echoing on or off.
ENDLOCAL       Ends localization of environment changes in a batch file.
ERASE          Deletes one or more files.
EXIT           Quits the CMD.EXE program (command interpreter).
FC             Compares two files or sets of files, and displays the
               differences between them.
FIND           Searches for a text string in a file or files.
FINDSTR        Searches for strings in files.
FOR            Runs a specified command for each file in a set of files.
FORMAT         Formats a disk for use with Windows.
FSUTIL         Displays or configures the file system properties.
FTYPE          Displays or modifies file types used in file extension
               associations.
GOTO           Directs the Windows command interpreter to a labeled line in
               a batch program.
GPRESULT       Displays Group Policy information for machine or user.
GRAFTABL       Enables Windows to display an extended character set in
               graphics mode.
HELP           Provides Help information for Windows commands.
ICACLS         Display, modify, backup, or restore ACLs for files and
               directories.
IF             Performs conditional processing in batch programs.
LABEL          Creates, changes, or deletes the volume label of a disk.
MD             Creates a directory.
MKDIR          Creates a directory.
MKLINK         Creates Symbolic Links and Hard Links
MODE           Configures a system device.
MORE           Displays output one screen at a time.
MOVE           Moves one or more files from one directory to another
               directory.
OPENFILES      Displays files opened by remote users for a file share.
PATH           Displays or sets a search path for executable files.
PAUSE          Suspends processing of a batch file and displays a message.
POPD           Restores the previous value of the current directory saved by
               PUSHD.
PRINT          Prints a text file.
PROMPT         Changes the Windows command prompt.
PUSHD          Saves the current directory then changes it.
RD             Removes a directory.
RECOVER        Recovers readable information from a bad or defective disk.
REM            Records comments (remarks) in batch files or CONFIG.SYS.
REN            Renames a file or files.
RENAME         Renames a file or files.
REPLACE        Replaces files.
RMDIR          Removes a directory.
ROBOCOPY       Advanced utility to copy files and directory trees
SET            Displays, sets, or removes Windows environment variables.
SETLOCAL       Begins localization of environment changes in a batch file.
SC             Displays or configures services (background processes).
SCHTASKS       Schedules commands and programs to run on a computer.
SHIFT          Shifts the position of replaceable parameters in batch files.
SHUTDOWN       Allows proper local or remote shutdown of machine.
SORT           Sorts input.
START          Starts a separate window to run a specified program or command.
SUBST          Associates a path with a drive letter.
SYSTEMINFO     Displays machine specific properties and configuration.
TASKLIST       Displays all currently running tasks including services.
TASKKILL       Kill or stop a running process or application.
TIME           Displays or sets the system time.
TITLE          Sets the window title for a CMD.EXE session.
TREE           Graphically displays the directory structure of a drive or
               path.
TYPE           Displays the contents of a text file.
VER            Displays the Windows version.
VERIFY         Tells Windows whether to verify that your files are written
               correctly to a disk.
VOL            Displays a disk volume label and serial number.
XCOPY          Copies files and directory trees.
WMIC           Displays WMI information inside interactive command shell.

For more information on tools see the command-line reference in the online help.

C:\\>
Victoria, could you explain the reason you posted that cat picture? Have you read the forum rules?
Quote from: Salmon Trout on August 11, 2010, 03:23:57 PM

Victoria, could you explain the reason you posted that cat picture? Have you read the forum rules?


No, I have not read any rules about Cats.  Where do I read about Cats?

•Make posts / comments that only relate to the original question / topic.

I cannot DELETE the Cat Picture.  Time ran out.

Quote
No, I have not read any rules about Cats.  Where do I read about Cats?

How is that Bill has been back more than a week and nothing has been done?

very convincing, Bill.
Quote from: Manasito on August 09, 2010, 05:50:22 PM
I haven\'t tried anything yet. But your list has been usefull, as well as the link you posted.

Manasito,

Im sorry the Thread got off topic.

You should now have a better understanding how to list your folders, music files and other files.

Good Luck

Ignore the off topic posts that offer no suggestions of how to list your files.

dir /?



Discussion

No Comment Found