What about from the command line? Sometimes (like on a headless server or when you ssh into the computer at work) you need to do the same thing from a shell. Here’s the best way I’ve found to do that:
find . ! -name 'file.txt' -type f -exec rm -f {} +
This will delete every file from the current directory except file.txt. Nice and easy.
No comments:
Post a Comment