LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Delete multiple hidden files (https://www.linuxquestions.org/questions/linux-general-1/delete-multiple-hidden-files-651901/)

Beresford 06-26-2008 04:03 PM

Delete multiple hidden files [SOLVED]
 
Is there a way to delete multiple hidden files in a directory. I only want to delete the hidden files, not the normal files.

I can list them, and delete them one at a time, but when there are 20 files I need to delete, then it's a waste of time.

Thank you in advance.

David the H. 06-26-2008 05:01 PM

Assuming the files all start with a leading '.', and that you want to remove all dotted files from the current directory and you aren't concerned with any subdirectories or other fancy stuff, it should be as s a simple as using a * wildcard. Just run
Code:

rm -i .*
Note that I added the -i flag that makes rm interactive, which is a usually good idea to use in case it tries to remove any files you want to keep.

Beresford 06-26-2008 06:56 PM

Sweet, that's exactly what I wanted. Thank you, you've just saved me many hours of typing :)

David the H. 06-27-2008 09:44 AM

No problem. The bash command line is very powerful and flexible. For a good primer on shell commands and scripting I highly recommend LinuxCommand.org.


All times are GMT -5. The time now is 04:19 AM.