Un programma che applica il comando X
su tutti i file specificati, in aderenza a quanto previsto dall'opzione Y
.
Il programma è distribuito come pacchetto ZIP: scaricare in una cartella temporanea e scompattare nella cartella di destinazione. Vedi sotto per il(i) link di download.
Qui di seguito trovi i link di download per l'installazione manuale del software:
HO (16/6/1995, Walter Howard) | Readme/What's new |
USAGE: HO "command" <filespecs> <options>
Options are CASE SENSITIVE.
Command Variables: @n name, @f full path, @p path, @d drive, @r file
root, @e extension, @'prompt' ask user, @l last @'prompt'
Execution Options: v=<verbosity>, /s subdirectories, -c Don't change
directories, /q Query, /d do DIRECTORY names, /x Use spawn(), /b Fast
mode, w=<batchfilename>, P=<environment variable> /r Regular
Expressions
File Selectivity: x=<Exclude FileSpec>, a=<ARSH> match attributes,
a!<ARSH> exclude attributes, a$<ARSH> include attributes, a+<ARSH>
special include, d write date, l access date, c created, s size
Comparison Operators: = equal to, } greater than or equal, { less
than or equal
Example:
ho "del @n" *.dat *.txt /q /s
Execute delete on every file fitting *.dat, and *.txt. Ask the user
to confirm each deletion (/q) and do the same with like files in
subdirectories (/s).
HO's purpose is to automate tedious file operations. HO is an extremely
expanded version of the batch file DO command.
HO was first written to handle the problem of programs which could only
handle one file at a time. For example, an editor which could only
accept one text file:
EDIT DOCUMENT.TXT
By using HO, one could enable that editor to sequentially edit multiple
files:
HO "EDIT @N" *.TXT
This means, "Do the EDIT command on every file matching *.TXT". The @N
becomes each full file name in turn that matches *.TXT.
HO will perform a command line on every file that matches a spec. You
give it a command line using normal characters and some special ones
that get replaced during execution. The command line is what you want
done on each of the files. This command line MUST be enclosed in quotes.
If you need to have quotes as part of the command, precede them with a
backslash, i.e. \"
Variable Description Example
------------------------------------------------------------------------
@n file name command.com
@f full path and name OS2\mdos\command.com
@p path/directory only OS2\mdos
@d drive letter C:
@r file root ( no extension ) command
@e file extension com
GENERAL OPTIONS
Multiple <filespec> are allowed, if no <filespec>, file names will be
taken from standard input. Files coming in from standard input are
assumed to be "ready to go" and are not screened for date, attribute or
any other criteria. This means that lines coming in on stdin can be any
text, not just file names, for HO to work on. Any string given on the
command line that HO does not have a special meaning for, will be
interpreted as a file specification.
v=<verbosity>
HO Level 1 - 10 how talkative should HO be, 0-silent,
10-highest. High HO is useful for telling you what the heck
is going on when behavior isn't what you expect.
+s or /s Do subdirectories also.
-c Don't change directories when executing commands.
IMPORTANT: HO will change its default directory to the
directory of the file it is working on unless you use the
-c option. Without -c, @n and @f both expand to the name of
the file without any directory. If -c is used then @f
gives a full/relative path to the file. @n still only
expands to the file name.
+q or /q Ask before each command is executed.
+d or /d Only do DIRECTORY names.
+x or /x Execute by spawn() instead of system(). Doesn't use CMD.EXE
to execute commands. Works faster but has less syntactical
power. Shell capabilities such as redirection ( < > or | )
and others are NOT understood.
+b or /b Write a cmd (batch) file and execute it all at once. MUCH!!!
faster if your operations are mainly shell commands. HO
automagically creates the batch file, executes it and
deletes it when done executing.
w=<batchfilename>
like /b except it saves the created batch file in the
specified name.
P=<environment variable>
HO will work each directory contained in the environment
variable ( PATH, DPATH, INCLUDE, etc ) you specify.
+r or /r HO will use unix style Regular Expressions to match files.
If you use this options, you MUST use / instead of \ in
your filespecs. This is because Regular Expressions use
\ as a special character. HO treats / just like \ when it
comes to directory specs. Regular expressions, designed
under unix, use many characters that can confuse the OS/2
command shell. You may occasionally have to put your
regular expressions within quotes so that OS/2 doesn't
interpret them wrong.
example: ho "del @n" /r "[0-9]+*"
x=<Exclude FileSpec>
HO will exclude files matching this spec. Up to 50 Exclude
FileSpecs are allowed. This option only works if Regular
Expressions are enabled.
ATTRIBUTE SELECTION
These options let you select files based on attributes
A = Archive
R = Read Only
S = System
H = Hidden
Specified like this for example: a$RSH
a= To be selected, file must exact match these attributes
a! If file has ANY of these it is excluded
a$ If file has ANY of these it is selected
a+ all normally visible files plus H or R if specified
You can select by dates and sizes also using the following symbols.
Symbol Meaning Example
--------------------------------------------------------------------------
d last write date d}2/1/93 write dated on or after 2/1/93
l last access date l{12:00:00 accessed before noon today
c created date c{12/16/86 created before 12/16/86
s size s}300000 size greater than 300000 bytes
= equal to l=10:00
} greater than or equal c}7/9/87
{ less than or equal to s{5
Note: Curly Braces are used rather than the obvious > and < because
those would tell the command interpreter to redirect input or output.
One equal or one greater and one less than are allowed. In other
words, it doesn't do you much good to specify files dated equal to
1/1/95 and greater than ( after ) 2/1/95. But you CAN have identical
comparisons in different categories. d=1/1/95 together with l=2/1/95
and s=3000 is valid.
Times and dates are represented together as a string of the form
MM/DD/YY-HH:MM:SS. The separation characters are pretty flexible, any
non-numeric characters will do. If you put a space between the date
and the time, be sure to enclose the entire date/time in parenthesis
or else they will be interpreted as separate parameters.
Time/Date values will match all files that fit within resolution. For
example, if you specify d=12/1/1996-12, this will match all files
with last write date 12/1/1996 in the 12 o'clock hour, regardless of
minute or second. Just specifying a time, c=7:00 for example, assumes
TODAY'S date.
You can enter times relative to now also. Using the words, last, next
startof, tomorrow, yesterday, minute, hour, day, month, year, this
and now.
For example, d=now, would be interpreted as d=the time and date right
now. d=startoflastweek would be interpreted as midnight of last
Sunday.
MULTIPLE COMMANDS and CONDITIONAL EXECUTION
Multiple commands can be executed by separating them with a semi-colon
(;). You may also prefix subcommands with a question mark if you want to
query the user about just that particular subcommand (vs /q for the
entire command). & works just like the question mark except that a NO
response will terminate processing of that entire group of subcommands.
HO "view @n;© @n d:\docs;?describe d:\docs\@n" *.doc
This would "view" each file, ask the user if she wanted to copy the
file and then ask her for a description of each file. If she answered
NO to the "copy" subcommand, HO would not execute the "describe"
subcommand because copy is preceded with a &, not a ?.
Note: the ? or & must come immediately after the semicolon (;?). You can
change the ; separation character to any characters of your liking with
the S= option, example: HO "copy @n a:\$attrib +r a:\@n" *.* S=$
UPPERCASE AND PROMPT
There some additional advanced variables you can put in the command
line.
Variable Description Expands to
------------------------------------------------------------------------
@'prompt' prompt user special - asks for value
@N file name COMMAND.COM
@F full path and name OS2\MDOS\COMMAND.COM
@P directory only OS2\MDOS
@D drive letter C:
@R file root ( no extension ) COMMAND
@E file extension COM
@l response to last @'prompt'
@N, @F etc. are simply upper case versions of previously mentioned
@symbols. The @'prompt' lets you ask the user for a value when HO
executes:
HO "ren @n @'New Name?'" *.* - This would ask for a value to rename the
file to.
EXAMPLES
HO "copy @f b:" c:\os2\*.exe d}2/20/93
copy all *.exe files in the \os2 directory, dated after or on 2/20/93 to
b:
HO "ren @n @'new file name'" *.* v=5
go through each file in the directory and ask the user for a new name.
Since verbosity is 5 ( v=5 ), HO will print a lot of information about
what is happening to the screen.
HO "del \"@n\"" /q <filelist.txt
delete all files whose names are in the file filelist.txt The /q would
also cause the user to be asked yes or no to each deletion. Notice the
@n is surrounded by quotes. The backslashes are needed so that HO will
not think the first " is the end of the command.
HO "copy @n b:\old\@n;?del @n" *.* s}300000 a=rh
copy all read-only hidden files sized 300000 or over to b:\old then
delete them. User will be asked yes/no/all/quit for the delete since
del is preceded by a ?.
HO "edit @n" P=INCLUDE *.h
will edit every file header file in every directory contained in your
INCLUDE environment variable
HO "copy @n a:" *.* a+HR
Copy all files to a: including Hidden and System files
HO "copy @f a:\archive\@f" *.txt c}today-2 -c /s
copy all *.txt files in this directory and subdirectories onto a
similar directory structure on the a: under the directory archive.
Don't change directories ( -c ) as you recurse down subdirectories
because you need to use the relative pathname ( @f ) to copy to the
proper relative path on the a: drive Copy the files only if they were
created within the last two days ( c}today-2 )
ho "dir @n;?del @n" l{thismonth e:\*.* /s
Go through all files on the e:\ drive ( e:\*.* ) and all its
subdirectories ( /s ), selecting those files whose date of last access
is less than the first of this month ( l{thismonth ). Display the
file's data ( dir @n ), and then ask the user if he wants to delete
the file ( ?del @n )
Historical Note: HO got its name from the ex who "done X to every guy in
town fitting specification Y" |
hobbes.nmsu.edu/download/pub/os2/util/batch/Ho_1995-06-16.zip |
This work is licensed under a Creative Commons Attribution 4.0 International License.
Commenti
Martin Iturbide
Ven, 04/08/2023 - 03:34
Collegamento permanente
New Link: https://hobbes.nmsu
Aggiungi un commento