7

I have a document (FILE-1) with two parent folders (FOLDER-1 and FOLDER-2).

If I delete FOLDER-1, FILE-1 is also deleted. However, I expected that only FOLDER-1 would be deleted, and removed as a parent of FILE-1, which would be left intact.

Is this the intended behavior, or a bug?

Trojan
  • 2,256
  • 28
  • 40
pinoyyid
  • 21,499
  • 14
  • 64
  • 115
  • 1
    I can only confirm the behavior, not that it's intended or not. Seems very peculiar to me, seems that deleting/trashing the folder the file was _originally uploaded to_ will do this, I can't make it happen in any other way. If the file removes the folder as parent first, it seems to work as intended and it doesn't disappear with the "upload folder". – Joachim Isaksson Oct 06 '12 at 05:51
  • Possible a duplicate. http://stackoverflow.com/questions/12778925/how-to-move-files-and-folders-using-google-drive-api – Lucas Locatelli Nov 19 '14 at 17:21

2 Answers2

4

It appears to be by design according to this Google Drive support documentation. It seems as though trashing a folder and removing a parent from a file are two completely different things.

3. The folder will be moved to Trash, and all items in that folder will also be moved to Trash.

adamdunson
  • 2,635
  • 1
  • 23
  • 27
  • To clarify, my question is regarding the API, not the Google web interface. My app allows files to be members of multiple transient folders. If I call the api delete command on a folder, I expect the api to delete the folder, and nothing else. This is what the api documentation states. I do not expect a chain of recursive deletes to occur, unless the api docs explicitly define this side effect behaviour. – pinoyyid Oct 20 '12 at 15:26
1

I also found same thing but I think they want this only..that when a folder is moved to trash all the items in that folder will also be moved to trash.

They might have done something like if you are willing to delete a folder they would have asked for the confirmation messaging whether user wants to delete files inside it or not and if not they would have asked user to move it to another folder but again its there choice and there way of thinking.

agaonsindhe
  • 447
  • 1
  • 5
  • 13
  • 1
    When you delete a folder/directory on your PC, doesn't it also delete all of the files inside of it? It seems to me that Google was trying to stick to a fairly standard convention of hierarchical file systems. I feel that it's important to note that Google makes a distinction between "removing a parent" and "trashing a folder". – adamdunson Oct 19 '12 at 11:34
  • @adamdunson agreed...as always they are keeping it simple n they are going with the standards.. – agaonsindhe Oct 19 '12 at 11:44
  • 1
    When I delete a folder on my pc using 'rm folder1' , I get an error that I tried to delete a directory. If I explicitly add a -f flag it decrements the link count of each child. Only if the link count == 0, the child is deleted. – pinoyyid Oct 20 '12 at 15:29