Hello,
I have a dataset which needs to be renamed.
The structurre of folder is as follows.
D:\XXXX\Control\PPMI\3104\MPRAGE_GRAPPA\2011-08-01_13_30_13.0\S120955\######.dcm
S120955 folder needs to changed as 3104 [great grandparent folder name]
How to Rename folder as great grandparent folder name
Re: How to Rename folder as great grandparent folder name
Go into the "D:\XXXX\Control\PPMI" folder (and nowwhere else^^) and execute the script...
You'd better do it with some test data, e.g. by duplicating your original folder(s)...
You'd better do it with some test data, e.g. by duplicating your original folder(s)...
One of my scripts helped you out? Please donate via Paypal
Re: How to Rename folder as great grandparent folder name
Hi, welcome to the forum.
Short answer, AFAIK not possible out of the box.
You would need to script this by getting the name of the folder two levels up and then rename the subfolders accordingly.
Edit: Two minutes too slow and there you already got a script done for you.
Short answer, AFAIK not possible out of the box.
You would need to script this by getting the name of the folder two levels up and then rename the subfolders accordingly.
Edit: Two minutes too slow and there you already got a script done for you.
Ralph
(OS: W11 22H2 Home x64 - XY: Current beta - Office 2019 32-bit - Display: 1920x1080 @ 125%)
(OS: W11 22H2 Home x64 - XY: Current beta - Office 2019 32-bit - Display: 1920x1080 @ 125%)
Re: How to Rename folder as great grandparent folder name
Thanks a lot...
Code: Select all
$firstSub = gpc($item, "component", -($cntRootSep +1));
However when i changed it to "+0 " the script worked as needed...
Re: How to Rename folder as great grandparent folder name
Replace the line with
then it should work regardless of depth...
I've reuploaded the script as well
$firstSub = gpc($item, "component", -($cntSep - $cntRootSep));
then it should work regardless of depth...
I've reuploaded the script as well
One of my scripts helped you out? Please donate via Paypal