Transfer Folder Langsung Antar Google Drive Tanpa Mendownload
*Untuk Mendapatkan Full Script tanpa password silahkan Klik Disini*
1. Buka Google Drive lalu buatlah lembar kerja Google Apps script.
2. Klik Buat Skrip
3. Pada lembar kerja apps script terdapat file default Code.gs
Masukkan Password Untuk Melihat Script (Password ada di dalam video)
// Script by Javabitpro.com
function doGet() {
return HtmlService.createTemplateFromFile('Index').evaluate()
.setTitle('Javabitpro')
.addMetaTag('viewport','width=device-width , initial-scale=1')
.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL)
.setFaviconUrl('https://cdn.jsdelivr.net/gh/javabitpro/javabitproimage@main/PNG%20JP.png');
}
function copyFolderServer(sourceFolderId, destParentId) {
try {
sourceFolderId = String(sourceFolderId).trim();
if (!sourceFolderId) {
return {
success: false,
message: 'Source Folder ID tidak boleh kosong'
};
}
let sourceFolder, destParent;
// --- Validasi Source Folder ---
try {
sourceFolder = DriveApp.getFolderById(sourceFolderId);
// Test akses dengan mengambil nama
sourceFolder.getName();
} catch (e) {
return {
success: false,
message: 'ID Folder Drive tidak ditemukan atau folder bersifat private (tidak punya akses)'
};
}
// --- Validasi Destination Folder (jika diisi) ---
if (destParentId && destParentId.trim() !== '') {
try {
destParent = DriveApp.getFolderById(destParentId.trim());
destParent.getName();
} catch (e) {
return {
success: false,
message: 'Destination Folder ID tidak ditemukan atau folder bersifat private'
};
}
} else {
destParent = DriveApp.getRootFolder();
}
var newFolder = destParent.createFolder(sourceFolder.getName() + ' - Copy');
var totalFiles = _countFilesRecursive(sourceFolder);
var copied = { count: 0 };
if (totalFiles === 0) {
return {
success: false,
message: 'Folder kosong atau tidak berisi file apapun'
};
}
_copyFolderRecursive(sourceFolder, newFolder, copied, totalFiles);
return {
success: true,
message: 'Folder berhasil disalin',
url: newFolder.getUrl()
};
} catch (err) {
return {
success: false,
message: 'Terjadi kesalahan: ' + err.message
};
}
}
// Hitung total file (untuk progress)
function _countFilesRecursive(folder) {
var total = 0;
var files = folder.getFiles();
while (files.hasNext()) { total++; files.next(); }
var subs = folder.getFolders();
while (subs.hasNext()) total += _countFilesRecursive(subs.next());
return total;
}
function _copyFolderRecursive(source, target, copied, total) {
var files = source.getFiles();
while (files.hasNext()) {
var f = files.next();
try {
f.makeCopy(f.getName(), target);
copied.count++;
_updateProgress(Math.round((copied.count / total) * 100));
} catch (e) {
Logger.log('Gagal copy: ' + f.getName() + ' ' + e);
}
}
// Script by Javabitpro.com
var subs = source.getFolders();
while (subs.hasNext()) {
var sf = subs.next();
var nf = target.createFolder(sf.getName());
_copyFolderRecursive(sf, nf, copied, total);
}
}
// Simpan progress di CacheService
function _updateProgress(pct) {
CacheService.getUserCache().put('progress', pct.toString(), 60);
}
function getProgress() {
return CacheService.getUserCache().get('progress') || '0';
}
function include(filename) {
return HtmlService.createHtmlOutputFromFile(filename)
.getContent();
}
// Script by Javabitpro.com
function doGet() {
return HtmlService.createTemplateFromFile('Index').evaluate()
.setTitle('Javabitpro')
.addMetaTag('viewport','width=device-width , initial-scale=1')
.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL)
.setFaviconUrl('https://cdn.jsdelivr.net/gh/javabitpro/javabitproimage@main/PNG%20JP.png');
}
function copyFolderServer(sourceFolderId, destParentId) {
try {
sourceFolderId = String(sourceFolderId).trim();
if (!sourceFolderId) {
return {
success: false,
message: 'Source Folder ID tidak boleh kosong'
};
}
let sourceFolder, destParent;
// --- Validasi Source Folder ---
try {
sourceFolder = DriveApp.getFolderById(sourceFolderId);
// Test akses dengan mengambil nama
sourceFolder.getName();
} catch (e) {
return {
success: false,
message: 'ID Folder Drive tidak ditemukan atau folder bersifat private (tidak punya akses)'
};
}
// --- Validasi Destination Folder (jika diisi) ---
if (destParentId && destParentId.trim() !== '') {
try {
destParent = DriveApp.getFolderById(destParentId.trim());
destParent.getName();
} catch (e) {
return {
success: false,
message: 'Destination Folder ID tidak ditemukan atau folder bersifat private'
};
}
} else {
destParent = DriveApp.getRootFolder();
}
var newFolder = destParent.createFolder(sourceFolder.getName() + ' - Copy');
var totalFiles = _countFilesRecursive(sourceFolder);
var copied = { count: 0 };
if (totalFiles === 0) {
return {
success: false,
message: 'Folder kosong atau tidak berisi file apapun'
};
}
_copyFolderRecursive(sourceFolder, newFolder, copied, totalFiles);
return {
success: true,
message: 'Folder berhasil disalin',
url: newFolder.getUrl()
};
} catch (err) {
return {
success: false,
message: 'Terjadi kesalahan: ' + err.message
};
}
}
// Hitung total file (untuk progress)
function _countFilesRecursive(folder) {
var total = 0;
var files = folder.getFiles();
while (files.hasNext()) { total++; files.next(); }
var subs = folder.getFolders();
while (subs.hasNext()) total += _countFilesRecursive(subs.next());
return total;
}
function _copyFolderRecursive(source, target, copied, total) {
var files = source.getFiles();
while (files.hasNext()) {
var f = files.next();
try {
f.makeCopy(f.getName(), target);
copied.count++;
_updateProgress(Math.round((copied.count / total) * 100));
} catch (e) {
Logger.log('Gagal copy: ' + f.getName() + ' ' + e);
}
}
// Script by Javabitpro.com
var subs = source.getFolders();
while (subs.hasNext()) {
var sf = subs.next();
var nf = target.createFolder(sf.getName());
_copyFolderRecursive(sf, nf, copied, total);
}
}
// Simpan progress di CacheService
function _updateProgress(pct) {
CacheService.getUserCache().put('progress', pct.toString(), 60);
}
function getProgress() {
return CacheService.getUserCache().get('progress') || '0';
}
function include(filename) {
return HtmlService.createHtmlOutputFromFile(filename)
.getContent();
}
6. Copy dan pastekan script dibawah ini ke Index.html
Masukkan Password Untuk Melihat Script (Password sama dengan di atas)
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- font-awesome@6.2.0 icon Visit -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css">
<?!= include('Visit')?>
</head>
<body class="bg-light">
<div class="container py-5">
<div class="card shadow-sm p-4 mx-auto" style="max-width:600px;">
<h3 class="mb-4 text-center">
<img src="https://upload.wikimedia.org/wikipedia/commons/d/da/Google_Drive_logo.png"
width="50" class="me-2">
Drive Folder Copier
</h3>
<div class="mb-3">
<label class="form-label">Source Folder ID</label>
<input id="src" class="form-control" placeholder="contoh: 1AbCdEfGhI...">
</div>
<div class="mb-3">
<label class="form-label">Destination Parent Folder ID (opsional)</label>
<input id="dst" class="form-control" placeholder="kosong = My Drive root">
</div>
<button id="copyBtn" class="btn btn-primary w-100" onclick="startCopy()">Mulai Salin Folder</button>
<div id="result" class="mt-3"></div>
</div>
</div>
<!-- Popup Modal Progress -->
<div class="modal fade" id="progressModal" tabindex="-1">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content text-center">
<div class="modal-header">
<h5 class="modal-title">Menyalin Folder...</h5>
</div>
<div class="modal-body">
<div class="progress mb-3" style="height: 25px;">
<div id="progressBar" class="progress-bar progress-bar-striped progress-bar-animated"
role="progressbar" style="width:0%">0%</div>
</div>
<p id="progressText" class="text-muted">Harap tunggu, sedang menyalin file...</p>
</div>
</div>
</div>
</div>
<script>
function clearForm(){
document.getElementById('src').value = '';
document.getElementById('dst').value = '';
}
let progressInterval;
function startCopy(){
const src = document.getElementById('src').value.trim();
const dst = document.getElementById('dst').value.trim();
const resultDiv = document.getElementById('result');
if(!src){
resultDiv.innerHTML = `<div class="alert alert-warning">Masukkan Source Folder ID!</div>`;
return;
}
// tampilkan modal progress
const modal = new bootstrap.Modal(document.getElementById('progressModal'));
modal.show();
progressInterval = setInterval(updateProgress, 1000);
google.script.run
.withSuccessHandler(res => {
clearInterval(progressInterval);
document.getElementById('progressBar').style.width = '100%';
document.getElementById('progressBar').innerText = '100%';
setTimeout(() => modal.hide(), 1000);
if(res.success){
resultDiv.innerHTML = `
<div class="alert alert-success">
✅ ${res.message}<br><br>
<a href="${res.url}" target="_blank" class="btn btn-success">
<img src="https://upload.wikimedia.org/wikipedia/commons/d/da/Google_Drive_logo.png"
width="18" class="me-2">
Buka Folder di Google Drive
</a>
</div>
`;
clearForm(); // ✅ Auto bersih jika sukses
}
else {
resultDiv.innerHTML = `<div class="alert alert-danger">${res.message}</div>`;
clearForm(); // ✅ Auto bersih jika sukses
}
})
.withFailureHandler(err => {
clearInterval(progressInterval);
modal.hide();
resultDiv.innerHTML = `<div class="alert alert-danger">Error: ${err}</div>`;
clearForm(); // ✅ Auto bersih jika sukses
})
.copyFolderServer(src, dst);
}
function updateProgress(){
google.script.run.withSuccessHandler(pct => {
const bar = document.getElementById('progressBar');
bar.style.width = pct + '%';
bar.innerText = pct + '%';
}).getProgress();
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- font-awesome@6.2.0 icon Visit -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css">
<?!= include('Visit')?>
</head>
<body class="bg-light">
<div class="container py-5">
<div class="card shadow-sm p-4 mx-auto" style="max-width:600px;">
<h3 class="mb-4 text-center">
<img src="https://upload.wikimedia.org/wikipedia/commons/d/da/Google_Drive_logo.png"
width="50" class="me-2">
Drive Folder Copier
</h3>
<div class="mb-3">
<label class="form-label">Source Folder ID</label>
<input id="src" class="form-control" placeholder="contoh: 1AbCdEfGhI...">
</div>
<div class="mb-3">
<label class="form-label">Destination Parent Folder ID (opsional)</label>
<input id="dst" class="form-control" placeholder="kosong = My Drive root">
</div>
<button id="copyBtn" class="btn btn-primary w-100" onclick="startCopy()">Mulai Salin Folder</button>
<div id="result" class="mt-3"></div>
</div>
</div>
<!-- Popup Modal Progress -->
<div class="modal fade" id="progressModal" tabindex="-1">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content text-center">
<div class="modal-header">
<h5 class="modal-title">Menyalin Folder...</h5>
</div>
<div class="modal-body">
<div class="progress mb-3" style="height: 25px;">
<div id="progressBar" class="progress-bar progress-bar-striped progress-bar-animated"
role="progressbar" style="width:0%">0%</div>
</div>
<p id="progressText" class="text-muted">Harap tunggu, sedang menyalin file...</p>
</div>
</div>
</div>
</div>
<script>
function clearForm(){
document.getElementById('src').value = '';
document.getElementById('dst').value = '';
}
let progressInterval;
function startCopy(){
const src = document.getElementById('src').value.trim();
const dst = document.getElementById('dst').value.trim();
const resultDiv = document.getElementById('result');
if(!src){
resultDiv.innerHTML = `<div class="alert alert-warning">Masukkan Source Folder ID!</div>`;
return;
}
// tampilkan modal progress
const modal = new bootstrap.Modal(document.getElementById('progressModal'));
modal.show();
progressInterval = setInterval(updateProgress, 1000);
google.script.run
.withSuccessHandler(res => {
clearInterval(progressInterval);
document.getElementById('progressBar').style.width = '100%';
document.getElementById('progressBar').innerText = '100%';
setTimeout(() => modal.hide(), 1000);
if(res.success){
resultDiv.innerHTML = `
<div class="alert alert-success">
✅ ${res.message}<br><br>
<a href="${res.url}" target="_blank" class="btn btn-success">
<img src="https://upload.wikimedia.org/wikipedia/commons/d/da/Google_Drive_logo.png"
width="18" class="me-2">
Buka Folder di Google Drive
</a>
</div>
`;
clearForm(); // ✅ Auto bersih jika sukses
}
else {
resultDiv.innerHTML = `<div class="alert alert-danger">${res.message}</div>`;
clearForm(); // ✅ Auto bersih jika sukses
}
})
.withFailureHandler(err => {
clearInterval(progressInterval);
modal.hide();
resultDiv.innerHTML = `<div class="alert alert-danger">Error: ${err}</div>`;
clearForm(); // ✅ Auto bersih jika sukses
})
.copyFolderServer(src, dst);
}
function updateProgress(){
google.script.run.withSuccessHandler(pct => {
const bar = document.getElementById('progressBar');
bar.style.width = pct + '%';
bar.innerText = pct + '%';
}).getProgress();
}
</script>
</body>
</html>
7. Copy dan pastekan script dibawah ini ke Visit.html
Masukkan Password Untuk Melihat Script (Password sama dengan di atas)
<link href="https://cdn.jsdelivr.net/gh/javabitpro/css@main/javabitprovisit.css" rel="stylesheet">
<div class="fab-container2">
</div>
<div class="fab-container">
<div class="fab fab-icon-holder">
</div>
<ul class="fab-options">
<li>
<span class="fab-label">Youtube</span>
<div class="fab-icon-holder">
<a target="_blank" href="https://www.youtube.com/watch?v=yEiExdVc-6U&list=PLDeNeiwBHjwYg7_gz2vDA1D6QfBiMgIj6&index=86"><i class="fa-brands fa-youtube"></i></i></a>
</div>
</li>
<li style="margin-bottom: 10px;">
<span class="fab-label">Website</span>
<div class="fab-icon-holder">
<a target="_blank" href="https://s.id/javabitpro"><i class="fa-solid fa-globe"></i></a>
</div>
</li>
</ul>
</div>
<link href="https://cdn.jsdelivr.net/gh/javabitpro/css@main/javabitprovisit.css" rel="stylesheet">
<div class="fab-container2">
</div>
<div class="fab-container">
<div class="fab fab-icon-holder">
</div>
<ul class="fab-options">
<li>
<span class="fab-label">Youtube</span>
<div class="fab-icon-holder">
<a target="_blank" href="https://www.youtube.com/watch?v=yEiExdVc-6U&list=PLDeNeiwBHjwYg7_gz2vDA1D6QfBiMgIj6&index=86"><i class="fa-brands fa-youtube"></i></i></a>
</div>
</li>
<li style="margin-bottom: 10px;">
<span class="fab-label">Website</span>
<div class="fab-icon-holder">
<a target="_blank" href="https://s.id/javabitpro"><i class="fa-solid fa-globe"></i></a>
</div>
</li>
</ul>
</div>
8. Klik ikon Save.
9. Klik tombol Deploy/Terapkan lalu pilih New Deployment/Deployment baru.
10. Klik ikon Gear, lalu pilih Aplikasi web. Pastikan hak aksesnya adalah Siapa saja/Anyone lalu klik Terapkan/Deploy.
11. Berikan ijin/akses script berjalan didalam google drive. (Tutorial didalam video)
12. Klik atau salin URL yang sudah di Deploy. Website siap digunakan.
SELESAI!!!
| Project | #JP104 Transfer Folder Langsung Antar Google Drive Tanpa Mendownload |
|---|---|
| Harga(IDR) | |
| Download |








