I need a simple script written for Google Apps Script to run through the files (not folders) in my root directory of My Drive in Google Drive to check if the file has more than one location. If the loop finds that the file has a location My Drive and another location, it must remove the My Drive location. If the file is only located in My Drive, then it must ignore that file.
The script must allow me to run the loop for 5 files (so I can test it) and also for All files in My Drive.
I have had lots of files transferred to me and most of them land up in the shared location and My Drive and I would like to remove the My Drive location.