Removing files matching a numeric range regular expression

35

Solution 1

You can try

rm some-files-with-numbers{0..300}

This will delete:

some-files-with-numbers0

some-files-with-numbers1

some-files-with-numbers2

...

some-files-with-numbers300

Solution 2

I like superuser’s answer, but to add another possibility:

find . -regex './some-files-with-numbers[123]?[0-9]?[0-9]' -delete
Share:
35

Related videos on Youtube

L.Nick
Author by

L.Nick

Updated on September 18, 2022

Comments

  • L.Nick
    L.Nick almost 2 years

        <cfif NOT DirectoryExists(ExpandPath(lv_upload_path))>
            <cfdirectory action="create"  directory="#ExpandPath(lv_upload_path)#">
        </cfif>
    
        <cfset lv_file_ext = listLast(FORM.filename_inv, ".") />
    
        <!--- replace special chars in comapny name except space, then replace space with underscore --->
        <cfset company_name = replaceSpecialChars(
            textString=FORM.company_name, 
            replaceTheseChars="33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,58,59,60,61,62,63,64,91,92,93,94,95,96,123,124,125,126"
        )>
        <cfset company_name = Replace( company_name, "#Chr(32)#", "_", "All" )>
    
        <cfset lv_file_name = company_name & "_Factura_" & replaceSpecialChars(FORM.in_supplier_inv) & "_" & DateFormat(FORM.in_when_inv, "dd.mm.yyyy") >
        <cfset lv_file_name_out = lv_file_name & "." & replaceSpecialChars(lv_file_ext)>
    
        <cffile action="upload" filefield="pickfiles_inv" destination="#ExpandPath(lv_upload_path & '/' & lv_file_name_out)#" nameconflict="MakeUnique">
    
        <cfset lv_document_name = CFFILE.serverfile />
    
        <cfset new_id = APPLICATION.po_management.f_savePOInvDocuments(
            p_po_inv_id=URL.id,
            p_supplier_number=FORM.in_supplier_inv,
            p_when_created=FORM.in_when_inv,
            p_amount=FORM.in_amount_inv,
            p_document_name=lv_document_name
    

    Im new so if I make incorrect question, just help with how make it more good in future.

    When upload a file give error back

    Element FILENAME_INV is undefined in FORM.

    • Adonis
      Adonis almost 7 years
      If you want to write a good question (which in turn will help you receive more help), I would suggest you read: stackoverflow.com/help/mcve
    • Beginner
      Beginner almost 7 years
      Start with dumping form scope to see whether the element is available?
    • L.Nick
      L.Nick almost 7 years
      thank you very much, I will
  • cYrus
    cYrus almost 12 years
    What about some-files-with-numbers301?
  • qdii
    qdii almost 12 years
    @cYrus I am aware of the limitations :) My answer was more aimed at being an alternative to superuser’s one.