I want to delete all files and folders within a folder except specific folders/files via userbutton.
For example:
Subfolder1
Subfolder2
Subfolder3
File1.txt
File2.txt
File3.txt
Command should delete everything except Subfolder3 and File3.
I want to delete all files and folders within a folder except specific folders/files via userbutton.
For example:
Subfolder1
Subfolder2
Subfolder3
File1.txt
File2.txt
File3.txt
Command should delete everything except Subfolder3 and File3.
This will do that:
Delete ~(Subfolder3|File3.txt)
Warning: It ignores the file selection and will delete everything in the current folder except those two items. (I think that's what you want but, just in case I'm wrong, thought it was worth warning about. )
Perfect, I tried similar but didn't work for me!
Thanks for warning, command is used deleting backuped settings, but keep some folders for new backup w/o need of recreating them (e.g. I backup Opera's config folders and single files seperately for easy restoring after sys-restore or an update).
But I have still one question:
If I use "delete c:\folder\sub" it will delete "sub". How can I keep "sub" and delete everything within (folders and files)? I tried adding a "" at the end, but this didn't work.
With * on the end:
Delete "c:\folder\sub*"
Thanks, tried ".", but not "*" !
But: That did not work with "delete c:\folder* ~(subfolder|file)".
Both are examples of wildcards. If you want the first wildcard to be applied to a particular folder like the second wildcard was, you do it like this:
Delete "c:\folder\sub~(subfolder3|file3.txt)"
Thank you.