Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get the list of files and folders that were copied from a .NET Framework #22

Open
raziel6868 opened this issue May 20, 2023 · 1 comment
Labels
improvement Improvements

Comments

@raziel6868
Copy link

Is your feature request related to a problem? Please describe.
After reviewing the source code of rcp.ps1, I suppose the script stores a list of folders in the registry key HKCU:\RCWM and then for each folder, the script uses robocopy to copy or move it to the specified destination. However, with thousands of folders and large files to copy, the amount of registry value generated in HKCU:\RCWM will be enormous, negatively impacting read/write speed of Windows Registry.

Describe the solution you'd like
I'm thinking of using System.Windows.Forms.Clipboard to get list of folders and files from users pressing Ctrl+C or click Copy on right click menu, after that you can use Robocopy loop to go through the list. What do you think ?

Add-Type -AssemblyName System.Windows.Forms
$selectedItems = [System.Windows.Forms.Clipboard]::GetFileDropList()

foreach ($item in $selectedItems) { something ... }

Additional context

@raziel6868 raziel6868 added the improvement Improvements label May 20, 2023
@GChuf
Copy link
Owner

GChuf commented May 22, 2023

@minlmao thank you for your recommendation!
That's right, the script stores folder paths into registry, however not every subfolder and file is stored into the registry, and the list gets cleaned after robocopy finishes - so the registry doesn't get bloated.

However, the idea is great. I've given it some thought and I think I could implement it together with the existing system.
Right now, I'm not sure if I can save the folder names to clipboard if the user is copying multiple folders through the right click menu. If there's an option to append folders to the clipboard, then it might be possible, because the script currently opens a new process for every folder selected. All of this would be solved if I had a proper context menu handler written in c++, for example.

For copying single folders, and for using ctrl+C, there should be no major problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvements
Projects
None yet
Development

No branches or pull requests

2 participants