Copy pattern to include folder name

I have a copy command (below) someone here created for me (see below). I have been trying to modify it to include the parent folder name right after where it says "-Index_" but I keep getting syntax errors. Please help me fix this.

Copy PATTERN * AS -Index_* TO {sourcepath|..}

@nofilenamequoting
Copy PATTERN * AS "-Index_{sourcepath|nopath|noterm}_*" TO "{sourcepath|..}"

I tested this and the result does't make sense. Instead of adding the name of the parent folder it is adding the name of the current folder. But everything else it does is still correct. It is adding "-Index_" and moving it to the parent folder.

I was thinking the parent folder of the files being copied (i.e. the current folder), rather than the parent of the folder the files are in.

In that case:

@nofilenamequoting
Copy PATTERN * AS "-Index_{sourcepath|..|nopath|noterm}_*" TO "{sourcepath|..}"
1 Like

Thanks!