Delete all files from within a directory that contain a specific word

YorkieMagento

I have navigated to a specific directory on the file system and wish to delete all files within the directory that contain 'sofa_' in their file name.

Can someone please suggest how this can be done?

terdon

If all files are in the same directory (no subdirectories) just run:

rm *sofa_*

If you need this to descend into subdirectories, either use find:

find . -name "*sofa_*" -type f -delete

Or, if you are using bash, enable the globstar option which makes ** match all files and 0 or more subdirectories (making it recursive):

shopt -s globstar

Then:

rm **/*sofa_*

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

extract all files from a directory that start with a specific word

From Dev

Delete files within all directories in a directory

From Dev

Delete all files within a directory, without deleting the directory

From Dev

Recusively delete all files that do not contain a word in their title

From Dev

How to delete all files and directory except one named directory from a specific folder in centos

From Dev

Deleting folders from directory which does not contain .txt files within it

From Dev

Delete a string from all files in a directory

From Dev

Delete All Files Older Than Specified Time Within A Directory (Ubuntu)

From Dev

Delete specific files in directory

From Dev

Remove a specific extension from all the files in a directory

From Dev

Remove a specific suffix from all the files in a directory

From Java

How to delete from a text file, all lines that contain a specific string?

From Dev

Delete all files in a directory

From Dev

Select all files from directory that contain file with given name

From Dev

Select all files from directory that contain file with given name

From Dev

Find specific word in all files in and beneath current directory

From Dev

remove blank lines from multiple files within a specific directory

From Dev

How to extract out specific information from files within a directory?

From Dev

Delete files and folders with specific name from a certain directory

From Dev

Delete files and folders with specific name from a certain directory

From Dev

How to delete top directory that contain all files inside modified at least n days before today?

From Dev

Perl delete all files in a directory

From Dev

How to delete files in folders and all subfolders which contain specific string in file name?

From Dev

Get all the files that starts with a specific word from a URL using ANT

From Dev

PHP Delete all files that contain a given string

From Dev

Delete all files in a directory, but keep the directory?

From Dev

delete all files in a directory that are not in a copy of a directory

From Dev

Remove all files contain specific string - Bash

From Dev

How to match all groups of text that contain a specific word in a specific line?

Related Related

  1. 1

    extract all files from a directory that start with a specific word

  2. 2

    Delete files within all directories in a directory

  3. 3

    Delete all files within a directory, without deleting the directory

  4. 4

    Recusively delete all files that do not contain a word in their title

  5. 5

    How to delete all files and directory except one named directory from a specific folder in centos

  6. 6

    Deleting folders from directory which does not contain .txt files within it

  7. 7

    Delete a string from all files in a directory

  8. 8

    Delete All Files Older Than Specified Time Within A Directory (Ubuntu)

  9. 9

    Delete specific files in directory

  10. 10

    Remove a specific extension from all the files in a directory

  11. 11

    Remove a specific suffix from all the files in a directory

  12. 12

    How to delete from a text file, all lines that contain a specific string?

  13. 13

    Delete all files in a directory

  14. 14

    Select all files from directory that contain file with given name

  15. 15

    Select all files from directory that contain file with given name

  16. 16

    Find specific word in all files in and beneath current directory

  17. 17

    remove blank lines from multiple files within a specific directory

  18. 18

    How to extract out specific information from files within a directory?

  19. 19

    Delete files and folders with specific name from a certain directory

  20. 20

    Delete files and folders with specific name from a certain directory

  21. 21

    How to delete top directory that contain all files inside modified at least n days before today?

  22. 22

    Perl delete all files in a directory

  23. 23

    How to delete files in folders and all subfolders which contain specific string in file name?

  24. 24

    Get all the files that starts with a specific word from a URL using ANT

  25. 25

    PHP Delete all files that contain a given string

  26. 26

    Delete all files in a directory, but keep the directory?

  27. 27

    delete all files in a directory that are not in a copy of a directory

  28. 28

    Remove all files contain specific string - Bash

  29. 29

    How to match all groups of text that contain a specific word in a specific line?

HotTag

Archive