Hi, I want to delete all the files in a directory that I am in except one file. How should I execute the command in the terminal?Thanks
Dear Vaynald,
To delete all the files, first, you need to enter to your considered directory and then use the below PHP codes:
rm !(file.txt)
Or
rm -f !(file.txt)
Note that you need to type the name of the file you do not want to delete Instead of file.txt.
Thank you for sending the message.
Good Luck
+8595670151
7 days a week, 24 hours a day