Created
December 11, 2018 04:18
-
-
Save daithinh/0e8956bd0e5f1777fd73e181b8c54ff9 to your computer and use it in GitHub Desktop.
Cách chuyển Google Drive sang tài khoản khác. Hướng dẫn chuyển dữ liệu tài khoản Google Drive mới nhất 2019 - GDrive.VIP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function duplicate() { | |
var sourceFolder = "DATA"; //Thư mục được chia sẻ - GDrive.VIP | |
var targetFolder = "My_Backup"; //Tên thư mục mới sẽ tạo và lưu trữ dữ liệu của bạn | |
var source = DriveApp.getFoldersByName(sourceFolder); | |
var target = DriveApp.createFolder(targetFolder); | |
if (source.hasNext()) { | |
copyFolder(source.next(), target); | |
} | |
} | |
function copyFolder(source, target) { | |
var folders = source.getFolders(); | |
var files = source.getFiles(); | |
while(files.hasNext()) { | |
var file = files.next(); | |
file.makeCopy(file.getName(), target); | |
} | |
while(folders.hasNext()) { | |
var subFolder = folders.next(); | |
var folderName = subFolder.getName(); | |
var targetFolder = target.createFolder(folderName); | |
copyFolder(subFolder, targetFolder); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment