I require assistance in transferring files from a single Google Drive folder to folders named after the file names.
The files come in two formats: .psd
and .jpg
. I am looking for a custom google.script
that can identify the file name, create a folder based on part of that name, and move all files starting with that specific name into the corresponding folder, regardless of their extension.
For instance, let's say I have 12 files named:
082234567_CI.psd
082234567_pic.jpg
082234567_pic2.jpg
082234567_pic3.jpg
082234568_CI.psd
082234568_pic.jpg
082234568_pic2.jpg
082234568_pic3.jpg
082234569_CI.psd
082234569_pic.jpg
082234569_pic2.jpg
082234569_pic3.jpg
In this case, I need the script to generate folders: 082234567
, 082234568
, and 082234569
, and then relocate the respective files into these newly created folders.
As a result, files like 082234569_CI.psd, 082234569_pic.jpg, 082234569_pic2.jpg, and 082234569_pic3.jpg will be stored inside the directory named 082234569, and so forth.