批处理文件删除具有特殊字符的文件夹中的所有文件

时间:2015-12-06 05:41:36

标签: wordpress batch-file

我需要一个批处理文件,可以删除文件夹中包含短划线(' - ')的所有文件。注意它们是图像文件,所以它们可以是png或jpeg等。任何想法?

谢谢!

2 个答案:

答案 0 :(得分:2)

<?php
/* @var $this VideoController */
/* @var $model Video */
/* @var $form BSActiveForm */
?>

<?php $form=$this->beginWidget('bootstrap.widgets.BsActiveForm', array(
    'id'=>'video-form',
    // Please note: When you enable ajax validation, make sure the corresponding
    // controller action is handling ajax validation correctly.
    // There is a call to performAjaxValidation() commented in generated controller code.
    // See class documentation of CActiveForm for details on this.
    'enableAjaxValidation'=>false,
    'htmlOptions' => array(
        'enctype' => 'multipart/form-data',
    ),

        )); ?>

    <p class="help-block">Fields with <span class="required">*</span> are required.</p>
<?php echo $form->errorSummary($model); ?>

<?php //echo $form->errorSummary($model); ?>

     <?php echo $form->labelEx($model,'user_id'); ?>
     <?php

  $this->widget('ext.select2.ESelect2',array(
  'name'=>'video[user_id]',
  'data'=>CHtml::listData(User::model()->findAll(), 'id', 'username'), //the whole available list
  'htmlOptions'=>array(
       'placeholder'=>' search User name?',
    //'options'=>$options, //the selected values
    //'multiple'=>'multiple',
    'style'=>'width:530px',
  ),
  ));
    ?> <br><br>
    <?php echo $form->errorSummary($model); ?>
<?php
 $this->widget('ext.EAjaxUpload.EAjaxUpload',
array(
        'id'=>'uploadFile',
        'config'=>array(
               'action'=>Yii::app()->createUrl('video/upload'),
               'allowedExtensions'=>array("mp4","3gp"),//array("jpg","jpeg","gif","exe","mov" and etc...
               'sizeLimit'=>1000*1024*1024,// maximum file size in bytes
               'minSizeLimit'=>1*1024,
               'auto'=>true,
               'multiple' => true,
               'onComplete'=>"js:function(id, fileName, responseJSON){ alert(fileName); }",
               'messages'=>array(
                                 'typeError'=>"{file} has invalid extension. Only {extensions} are allowed.",
                                'sizeError'=>"{file} is too large, maximum file size is {sizeLimit}.",
                                'minSizeError'=>"{file} is too small, minimum file size is {minSizeLimit}.",
                                'emptyError'=>"{file} is empty, please select files again without it.",
                                'onLeave'=>"The files are being uploaded, if you leave now the upload will be cancelled."
                               ),
               'showMessage'=>"js:function(message){ alert(message); }"
               )

               ));
?>

    <?php //echo $form->textFieldControlGroup($model,'fileName',array('maxlength'=>45)); ?>
    <?php //echo $form->textFieldControlGroup($model,'user_id'); ?>

    <?php echo BsHtml::submitButton('Submit', array('color' => BsHtml::BUTTON_COLOR_PRIMARY)); ?>

<?php $this->endWidget(); ?>

答案 1 :(得分:1)

根据您的偏好编辑以下代码。

@echo off
cd /d "LocationOfItems"
echo Deleting all items with "-"...
del *-*
echo Completed.
pause

通配符允许在字符串的任何一端进行变化。文件类型是可选的。在这个例子中,它不需要指定,因为它们是不同的(jpg,png等)。