Find the answer to your Linux question:
Results 1 to 3 of 3
Hi everyone, Can somebody please tell me how can I make use of the following command: find . -type f -name ".number" -exec rm -f {} \; , in order ...
  1. #1
    Linux User
    Join Date
    Jul 2007
    Location
    Greece
    Posts
    277

    the find command

    Hi everyone,

    Can somebody please tell me how can I make use of the following command:
    find . -type f -name ".number" -exec rm -f {} \;, in order to delete files with a numeric extension?

    For example, I have a folder that includes files ending to .shk and other files ending to .shk.123456, which basically are a back up copy of a software program I am using.
    I only need the .shk files not the .shk.1233445 files.

    Does anyone know how to define the numeric extension of a file in the bash command above?

    Thanks a lot guys.

    goude

  2. #2
    Linux User
    Join Date
    May 2008
    Location
    NYC, moved from KS & MO
    Posts
    251
    cd to the folder that contains the .shk and .shk.###### files, then
    find . -type f ! -name '*shk' -exec rm -f {} \;

    This will delete any files NOT ending in .shk under the current directory.

  3. #3
    Linux User
    Join Date
    Jul 2007
    Location
    Greece
    Posts
    277
    Thank you very much second mouse.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...