I need help please!

Hello, I need your help :

I have to create a script which breaks down into 2 parts, the first is to copy a folder with all of these sub-folders in a directory that the user chooses with a name also chosen by the user.
The second part should take care of navigating to the last subfolder and give users permission to add or delete files only in this last subfolder and not give any permissions in the other subfolders.
The first part works perfectly, but I have no idea how to create the second or even if it is feasible.

Hope you understood… Thanks for your help !

The screenshot represents the first part of the script :

represents the first part of the script :

(Sorry for my English, i’am french)

Welcome to the forums.

If you post code please post this code as text and format it as code. Pictures of code are not helpful as we cannot copy and run the code from it. :wink:

Regardless of that: Your subject should give a hint what your question is about. 99% of the questions here are “looking for help”. :wink:

What exactly do you mean with “last subfolder”? Manipulating ACLs with PowerShell is very unintuitive and error prone in my opinion. You could try to use a specialized module to help you with it. You may search the PowerShellGallery for “ntfs rights”.

1 Like

The folder to copy in the first part is made up of several subfolders themselves composed of subfolders and it is necessary to assign the rights to add file only to the last subfolder, users should not be able to modify the subfolders as long as they are 'there is still a subfolder after, do you think this is possible?

Probably it is. But I don’t have exerience with such an approach. To manipulate the permissions on those folders the users need to have full access to those folders. Why should they limit the permissions they have already? It sounds like a very weird requirement to me. And … if there are several subfolders there are probably more than one “last” subfolder.
That will going to be a nightmare to maintain.

I’d urgently recommend to re-consider your requirements. I’m pretty sure there has to be a better way.

1 Like

Anytime you ask for input from general users, you are asking for trouble. At the very least, you will need to validate the user input to make sure you can even create the foldername they provide. Most users have no concept of drive letters and or UNC paths. I would seriously re-think what you are trying to do. My $.02

1 Like

Indeed I agree with you! Unfortunately this is what my internship supervisor asks me …

If this an internship assignment or homework question we try avoid assisting with those as the first port of call should be your tutor or supervisor.

It sounds like this could be a kind of user driven backup solution. It might be better either to provide the user a choice of target folders to pick from or to simply use an automatically created folder with a time stamp as name.