Page 1 of 1

Delete all except files/folders starting with hash

Posted: 16 Jan 2019 08:52
by acicovic
Hi,

I have a deep folder/file structure with thousands of files. I will be renaming certain files and folders with a hash character at the beginning of their filename. Then, I would like to delete all files and folders except the files/folders starting with a hash, keeping the folder structure intact for those files.

I hope what I say is clear.

Is there a fast way to do this with XYplorer?

Thanks!

Re: Delete all except files/folders starting with hash

Posted: 16 Jan 2019 09:52
by highend
I hope what I say is clear.
No

What happens with subfolders of folders that start with a hash or files in them?

Code: Select all

.\#root
.\#root\no_hash_folder -> To be deleted?
.\#root\no_hash_folder\no_hash_file.ext -> To be deleted?

Re: Delete all except files/folders starting with hash

Posted: 16 Jan 2019 10:01
by acicovic
Hi,

Thanks for asking, this way it's clearer. Any files or folders within a folder starting with a hash should not be deleted.

Re: Delete all except files/folders starting with hash

Posted: 16 Jan 2019 10:23
by highend
Then you could write a simple script that collects all folders, remove those that DO NOT start with a hash,
loop over the remaining ones, find all files and then delete all of them that don't start with a hash.

In a last step you could also remove those folders (not starting with a hash) that don't contain files
any more...

Re: Delete all except files/folders starting with hash

Posted: 16 Jan 2019 12:19
by acicovic
Hi, thanks for your input. I'll see if I'll resort to scripting as I'm not that comfortable with it yet (I wrote my first script yesterday).

Re: Delete all except files/folders starting with hash

Posted: 16 Jan 2019 13:40
by highend
I wrote my first script yesterday
Perfect start to dive in deeper :tup:

Re: Delete all except files/folders starting with hash

Posted: 17 Jan 2019 15:03
by highend
And, any progress?

Re: Delete all except files/folders starting with hash

Posted: 17 Jan 2019 15:05
by acicovic
Hi !

I've been too busy with other stuff so I haven't even tried for the time being.