How can I write a script that moves files with a certain name from a certain folder to another certain folder in my Google drive?

Example: I have a folder named 'A' with three files named 'X', 'Y', and 'Z'. I want to move the file 'X' out of that folder to another folder 'B', and the file 'Y' to another folder 'C'.

This is maybe a bit messy, but I basically want to move files with certain names to a certain folder on my Google Drive.

I would be very grateful if someone made a full script that I just can copy and paste.


If you have a directory like this :

├── X.1
├── X.2
├── X.3
├── Y.1
├── Y.2
└── Z.1


mkdir A
mv *X* A

(*X* means every file or folder containing X in its name)

results in

├── A
│   ├── X.1
│   ├── X.2
│   └── X.3
├── Y.1
├── Y.2
└── Z.1
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.