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!
Delete all except files/folders starting with hash
-
highend
- Posts: 15005
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Delete all except files/folders starting with hash
NoI hope what I say is clear.
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?
One of my scripts helped you out? Please donate via Paypal
-
acicovic
- Posts: 42
- Joined: 31 Oct 2017 19:52
Re: Delete all except files/folders starting with hash
Hi,
Thanks for asking, this way it's clearer. Any files or folders within a folder starting with a hash should not be deleted.
Thanks for asking, this way it's clearer. Any files or folders within a folder starting with a hash should not be deleted.
-
highend
- Posts: 15005
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Delete all except files/folders starting with hash
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...
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...
One of my scripts helped you out? Please donate via Paypal
-
acicovic
- Posts: 42
- Joined: 31 Oct 2017 19:52
Re: Delete all except files/folders starting with hash
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).
-
highend
- Posts: 15005
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Delete all except files/folders starting with hash
Perfect start to dive in deeperI wrote my first script yesterday
One of my scripts helped you out? Please donate via Paypal
-
highend
- Posts: 15005
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Delete all except files/folders starting with hash
And, any progress?
One of my scripts helped you out? Please donate via Paypal
-
acicovic
- Posts: 42
- Joined: 31 Oct 2017 19:52
Re: Delete all except files/folders starting with hash
Hi !
I've been too busy with other stuff so I haven't even tried for the time being.
I've been too busy with other stuff so I haven't even tried for the time being.
XYplorer Beta Club