How to move some files from a series of folders to another series of folders at same directory level

1 view (last 30 days)
Hi, I am processing dicom files (MRI, CT modalities) to be anonymized and have some fields of their metadata updated . The resulting anonymized dicom files are being stored in the same folder where the original files (with patient's real info) are. I want to move these newly created anonymized files to a new set of subfolders. These new subfolders are at the same directory level as the original subfolders are.
This is how the structure of the folders and subfolders are prior to run the mfile.
Parent_folder
Subfolder_MRI
subfolder_1..has original dicom files
subfolder_2..has original dicom files
subfolder_n..has original dicom files
After running mfile, subfolders with similar names as the original subfolders are created at the same directory level.
Parent_folder
Subfolder_MRI
subfolder_1..Contains original and Anonymized.dcm files
subfolder_2
subfolder_n
Case#_Anon_Subfolder_MRI
Case#_Anon_subfolder_1..this is where I want to move Anonymized.dcm files from subfolder_1
Case#_Anon_subfolder_2..this is where I want to move Anonymized.dcm files from subfolder_2
Case#_Anon_subfolder_n..this is where I want to move Anonymized.dcm files from subfolder_n
For organization purposes, the anonymized files are renamed using the Case# and the name of the original subfolder. e.g Case#_subfolder1%s.dcm where %s changes value progressively as the loop runs through all original dicom files.
Thank you for any advice on how to do this!

Answers (1)

Natch Ruengsakulrach
Natch Ruengsakulrach on 14 Apr 2017
Hi Julio, you may find the function "mkdir" useful. Check out the examples in the "mkdir" doc page, particularly "Create a Subfolder in the Specified Parent Folder".
Alternatively, you could also use the "system" command to create folder. For example, system('mkdir ../Case#_Anon_Subfolder_MRI').

Categories

Find more on DICOM Format in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!