Bash:Find中的编号文件

时间:2015-05-28 16:51:23

标签: linux bash find

我正在编写一个bash脚本,用于查找和删除blender在编辑和保存.blend文件时创建的.blend1和.blend2文件。它包含成对的行,如下所示:

Schedule

这很好用,虽然我很好奇如果能够以某种方式组合这两个find命令,那么它只是一个查找和删除.blend1和.blend2文件的命令。

不是非常重要,如果我的脚本更紧凑,我会更喜欢它。

3 个答案:

答案 0 :(得分:3)

-delete

find Documents '(' -name '*.blend1' -o -name '*.blend2' ')' -delete find Documents -name '*.blend*' -delete 是GNU查找扩展名。)

其他方式:

<div id="map"></div>

答案 1 :(得分:2)

这是另一种方式......

None

答案 2 :(得分:0)

是的,您可以使用正则表达式将多个模式匹配为一个:

find

或者使用较新的find Documents -regextype posix-egrep -regex '.*\.(blend1|blend2)$' -delete 版本:

find Documents \( -name "*.blend1" -o -name "*.blend2" \) -delete

如果没有正则表达式,你可以这样做:

        <ListBox
            Name="lbxUninspectedPrints"
            Height="125"
            Margin="16,0"
            Background="{StaticResource primaryBrush}"
            Foreground="White"
            VerticalAlignment="Top"
            VerticalContentAlignment="Top"
            HorizontalContentAlignment="Left"
            ScrollViewer.CanContentScroll="True"
            ScrollViewer.VerticalScrollBarVisibility="Hidden"
            ScrollViewer.HorizontalScrollBarVisibility="Disabled"
            ItemsSource="{Binding UninspectedPrintList}">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel/>
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Button
                        DataContext="{Binding}"
                        Width="44"
                        Height="24"
                        VerticalAlignment="Top"
                        VerticalContentAlignment="Center"
                        HorizontalAlignment="Left"
                        HorizontalContentAlignment="Center"
                        Content="{Binding}"
                        Command="{
                            Binding DataContext.DiePrintNav.UninspectedPrintSelectedCommand,
                            RelativeSource={RelativeSource AncestorType=ListBox}}"
                        CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Content}">
                        <Button.Template>
                            <ControlTemplate TargetType="Button">
                                <Border
                                    BorderBrush="White"
                                    BorderThickness="2"
                                    Background="Transparent">
                                    <Border.Triggers>
                                        <EventTrigger RoutedEvent="Border.MouseEnter">
                                            <EventTrigger.Actions>
                                                <BeginStoryboard>
                                                    <Storyboard>
                                                        <ColorAnimation
                                                            Storyboard.TargetProperty="
                                                                (Border.Background).
                                                                (SolidColorBrush.Color)"
                                                            From="Transparent"
                                                            To="{StaticResource accentColorTwo}"
                                                            Duration="0:0:0.25"/>
                                                    </Storyboard>
                                                </BeginStoryboard>
                                            </EventTrigger.Actions>
                                        </EventTrigger>
                                        <EventTrigger RoutedEvent="Border.MouseLeave">
                                            <EventTrigger.Actions>
                                                <BeginStoryboard>
                                                    <Storyboard>
                                                        <ColorAnimation
                                                            Storyboard.TargetProperty="
                                                                (Border.Background).
                                                                (SolidColorBrush.Color)"
                                                            From="{StaticResource accentColorTwo}"
                                                            To="Transparent"
                                                            Duration="0:0:0.25"/>
                                                    </Storyboard>
                                                </BeginStoryboard>
                                            </EventTrigger.Actions>
                                        </EventTrigger>
                                    </Border.Triggers>
                                    <ContentPresenter
                                        TextBlock.TextAlignment="Center"
                                        TextBlock.Foreground="White"
                                        TextBlock.FontFamily="SegoeUI"
                                        TextBlock.FontSize="14"
                                        Content="{TemplateBinding Content}"/>
                                </Border>
                            </ControlTemplate>
                        </Button.Template>
                    </Button>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>