Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

I need to duplicate an entire folder on my Google Drive once a week. There are about 25 files in the folder. What is an easy way to do this?

share|improve this question
    
From the web interface I assume. This would be academic if you're using the client and syncing to a folder on your PC. –  Al E. Feb 8 '13 at 3:04
    
are you wanting to just back the stuff up in that folder? or are you trying to add it to another google account? Do you need the entire contents of the folder or will just the pointers do? –  William Feb 8 '13 at 20:24
    
I needed to duplicate it because I want to have different permissions on them, for this, I need to have separated environments. But using google drive for PC worked fine! –  Dude2012 Feb 27 '13 at 20:13

4 Answers 4

up vote 6 down vote accepted

If you are using the Google Drive application on your PC you can copy and paste the folder in the Google Drive directory, and this would copy it. I do not believe it is possible to do this from the web application.

share|improve this answer
    
That worked just fine! Thanks! –  Dude2012 Feb 27 '13 at 20:13
    
Unfortunately for Linux users, till today Google doesn't have support for "Google Drive Application". Hence they need to use something called "grive" –  iammilind Apr 9 at 5:00
    
Will it re-upload the entire new folder to the web, or does it know that the contents of the folder are identical and it duplicates it without a full re-upload? –  Julian Aug 1 at 16:23
    
@Julian I would assume that it reuploads the whole thing. –  Fogest Aug 1 at 17:42
    
I just confirmed that it indeed reuploads all files. Bummer. –  Julian Aug 2 at 5:22

I use multiple machines and don't want to put the drive app on all of them so I have written the below script to copy on the site. It’s ugly and basic but it works. It only copies a folder and its files, not sub folders. I am sure there is room for improvement, so feel free to take this and improve it, but I hope it’s at least helpful from the start.

Per a comment below, this is a Google Apps Script. The way to use it is to open the Google scripting app, then copy and past all of the code into a blank script. After that click the publish option on the Menu, then select deploy as web app. You can then click the Latest code link or copy and paste the URL into your browser. Then, you will find a box where you can type the folder that you want to copy, and the copy button. That should create a copy of the folder you have named, and a copy of all of the files within.

Note: it will not copy sub-folders, just the files.

function doGet()
{
  // Build UI
  // Create UI object
  var copyUI = UiApp.createApplication();
  // Create Input box referenced later by the name explicitly set below
  var userInput = copyUI.createTextBox().setName("textbox1");
  //create button
  var enterButton = copyUI.createButton("copy");
  // add all objects to UI object
  copyUI.add(userInput).add(enterButton);

  //Create clicke event handeler and add input field to handeler
  var clickHandler = copyUI.createServerHandler('onClick')
  .addCallbackElement(userInput);

  // add handelrer to the copy button
  enterButton.addClickHandler(clickHandler);

  // instantiate GUI
  return copyUI;
}


function onClick(e)
{
  // call currently active application/gui
  var app = UiApp.getActiveApplication();

  //Pass in the value of the e paramater named 'textbox1'
  var input = e.parameter.textbox1;

  // log value passed in from user input
  //Logger.log(input);

  // perform file copy
  CopyFile(input);
}


function CopyFile(filename)
{
  // declaire variables
  var newFolder_String;
  var newFolder;
  var originalFolder;
  var fileArray;
  var loopCount;
  var arrayLength;
  var newFile;
  // get original folder id
  originalFolder = DocsList.getFolder(filename);
  Logger.log(originalFolder.getId());


  // create new "copy" folder using: createFolder(<filename>_copy)
  newFolder_String = filename + "_Copy";
  Logger.log(newFolder_String);
  newFolder = DocsList.createFolder(newFolder_String);

  // get folders and files from original file using: 
    //   getFiles() from original file into an array
  fileArray = originalFolder.getFiles();

  // Copy files into folder:
  arrayLength = fileArray.length;
  loopCount = 0;

  // looping through array of file
  for (loopCount = 0; loopCount < arrayLength; loopCount++)
  {
    // create file copies using: file[i].makeCopy() and newFile.addToFolder(CopyFolder)
    newFile = fileArray[loopCount].makeCopy();
    Logger.log(newFile.getName());
    newFile.addToFolder(newFolder)
  }

}
share|improve this answer
    
I'm guessing this is a Google Apps Script, but that may not be obvious to the OP or other readers. Could you clarify that in your answer, and perhaps add instructions on how to install and run your script? –  Vidar S. Ramdal Feb 24 at 12:11

Have written an App Script just to address this problem. You can copy any folder contents as well as the structure in it. Script will help eliminate the need of Google Drive desktop app. By adding triggers you can even automate the process.

GDrive Copy Folder Structure/Content Script

Copy Folder Structure in Google Drive

share|improve this answer

To duplicate a folder drag & drop it on another folder holding CTRL button.

share|improve this answer
3  
That doesn't duplicate; it just creates a pointer. I tested this by doing the Ctrl-drag-n-drop of a folder to a couple of different places, then created a file in the folder, and the file is visible in every place. –  Al E. Feb 8 '13 at 19:45
    
That's right. They call it "adding a folder" –  th3an0maly Jul 16 '13 at 23:33
    
-1, doesn't work. –  Pacerier Oct 31 at 9:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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