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

Infinite Recursive Folder Copy #13

Open
fivezeroes opened this issue Jul 19, 2018 · 6 comments
Open

Infinite Recursive Folder Copy #13

fivezeroes opened this issue Jul 19, 2018 · 6 comments

Comments

@fivezeroes
Copy link

If you attempt to copy some folder A into itself, the result will run infinitely and soft-lock the system. Not sure of the appropriate fix, perhaps a temporary directory to copy files to, and then move them to the final directory, or add an exception to ignore itself when copying. ¯\(ツ)

@fennectech
Copy link

That would increase wear on the sdcard sadly. It would have to be done on a case by case process. Check weather your copying a file into its subdir each time you copy a file and complain to the user if they are trying to copy a file onto itself.

@fivezeroes
Copy link
Author

The ignore itself thing might still be viable I'd imagine, I haven't really done much for file handling outside of copy and paste C++ and Python methods, but if there's a way to look at the destination folder like a pointer then just pass that as something to ignore from for the copy function.

@joel16
Copy link
Owner

joel16 commented Jul 19, 2018

Yeah I'll just check if the destination path is the same as source path and if it is make it do nothing. No point in copying the same folder unless it has something different. Perhaps I should add a confirmation dialog for overwriting files. I'll take a look when I get time.

@fennectech
Copy link

Also check that the folder your copying to isnt inside the folder your copying. So. Dont copy /switch/edizon to /switch/edizon/files/ as that can get. Problematic.

@fivezeroes
Copy link
Author

Oops commented with my alt account. Another thing that came to mind with the overwrite prompt, would it be relatively easy to offer rename on paste? What originally brought this about was me wanting to copy a folder but hoping it would add something like " - copy" to the end of the name, but instead having to copy it to a temporary directory, rename it, and then move it next to the original folder.

@ghost
Copy link

ghost commented Aug 30, 2022

Solution is very easy - just create list of files to copy before copy and do not use recursion.

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

No branches or pull requests

3 participants