delete all files and folder except 1.zip in folder
- User
delete all files and folder except 1.zip in folder
- Assistant
To delete all files and folders in a specific directory except for
1.zip, you can use command line commands based on the operating system you are using. Here's how you can do it for both Windows and Unix/Linux systems:On Windows (Command Prompt)
-
Open Command Prompt.
-
Navigate to the directory that contains the files and folders (replace
C:\path\to\your\folderwith your actual path):cmdcd C:\path\to\your\folder -
Run this command:
cmdfor /f "delims=" %f in ('dir /b ^| findstr /v /i "1.zip"') do del "%f"
This command lists all files and folders, excludes
1.zip, and deletes the rest.On Unix/Linux (Terminal)
-