📄 do_with.cmd
字号:
/* This is a REXX command file *//*#*#* Name: do_with input_file_with_names command flags#*#* Purpose:#* To process the files or the directories specified in#* "input_file_with_names" using the "command" and the "flags" specified#* in the line command. The last flag should contain the action that will#* deal with the file, such as -extract or -create.#*#* The "input_file_with_names" is the file with the list of filenames or#* directories, in the format of 1 name per row.#*#* You can obtain the list of the filenames in your directory and all the#* subdirectories, in one column, by using the command in Windows NT or 95:#*#* dir /b /s > input_file_with_fileNames (full path only filenames)#*#* You can obtain the list of the filenames in your directory in one column,#* by using the command:#*#* (in AIX) ls -1 > file_with_fileNames#*#* Examples (Intel):#*#* a) To extract all the files specified in the input_file in the directory#* C:\WORK:#*#* Windows: rexx do_with files.dir File -relative C:\WORK -extract#*#* b) To create the directories specified in input_file starting in the#* current directory;#*#* Windows: rexx do_with directr1.dir mkdir#*#* c) To delete the files inside the directories specified in input_file:#*#* Windows: rexx do_with director1.dir del /n#*#* d) To remove the directories:#* NOTE: if the file directr1.dir was used to create the directories, then#* it is necessary to reverse the order of the directories to be#* removed. Let's assume that directr2.dir is the reverse of#* directr1.dir.#*#* Windows: rexx do_with director2.dir rmdir#*#* Note for CMVC:#* The following environment variables must be specified before#* invoking this batch_file. These variables can be set in the#* config.sys/registry or by setting them directly from the command prompt.#*#* CMVC_FAMILY#* CMVC_BECOME#* CMVC_RELEASE#* CMVC_COMPONENT#*#* Note for VisualAge TeamConnection:#* The following environment variables must be specified before#* invoking this batch_file. These variables can be set in the#* config.sys/registry or by setting them directly from the command prompt.#*#* TC_FAMILY#* TC_BECOME#* TC_RELEASE#* TC_COMPONENT#*#**********************************************************************//* *//* Get the input parameters/arguments */PARSE ARG input_file command flags/* Initialize variables */usage="usage: do_with input_file_of_filenames command flags"/* Do the processing only if the command was specified */IF ( command \= "" ) THENDO SAY "do_with: begin" /* Open file */ rc = STREAM( input_file, C, 'open read' ) IF ( rc \= "READY:" ) THEN DO SAY "do_with: error while trying to open input_file: " input_file SAY " the return code from opening the stream is: " rc SAY "do_with: exiting due to error." EXIT END /* Process each entry in the file with the list of filenames */ DO UNTIL ( LINES( input_file ) = 0 ) /* Read until the end of file *//* SAY "do_with: " command flags filename */ filename = LINEIN( input_file )/* Need to surround the filename with double quotes, just in case there are blanks */ say command flags '"'filename'"' command flags '"'filename'"' END /* Close file */ rc = STREAM( input_file, C, 'close' ) SAY " " SAY "do_with: done!"ENDELSE /* If any of the input parameters are missing, display usage */DO SAY "do_with: ==> parameters missing." SAY " " usageENDEXIT/*------- the end --------------------------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -