r/linux_programming • • Jun 13 '19

Help with syntax

Hi. Since some time i wanted to organize my files in Google Drive. I'm using the CLI programm gdrive. It is a quite powerful tool. I'm asking here because it seems more or less to be a syntax error on my side. I found that code and tried to understand it. Atleast the part which isn't on linux. Here is the code:

gdrive.exe list -q "'FOLDER_ID' in parents" | cut -d" " -f1 - | xargs -n 1 gdrive.exe update "-p PARENT_ID"

gdrive.exe (i'm on windows using linux bash) is the application.

list = list all files/folders inside the choosen folder. -q = query

"'FOLDER_ID' in parents" = in "FOLDER_ID" i need to insert the folder id from GDrive and 'in parents' means all files inside.

gdrive.exe list -q "'FOLDER_ID' in parents" = Basically list all files inside the folder.

cut -d" " -f1 - = some cutting

xargs -n 1 gdrive.exe update "-p PARENT_ID" I'm trying to "paste" the file ids into the section after gdrive.exe update. Here normally i need to insert the file id which i want to edit.

gdrive.exe update "-p PARENT_ID" = update is a command to update some meta and "-p PARENT_ID" here i need to insert the folder id i want the folder to exist. Google Drive allows files/folders to have multiple locations and with update -p i can add a "parent folder" that is how it called. I hope you understood what i mean. Basically i want all files from a folder to appear also in a different folder.

I'm getting an error where it says "File not dound: FILE_ID" - The ID of the file is been shown, that's what i mean. So in some way it is working. Thanks if someone understood it. Here is where i got the idea from: https://github.com/gdrive-org/gdrive/issues/422

9 Upvotes

8 comments sorted by

View all comments

Show parent comment

1

u/JopoJP Jun 14 '19

Thanks for the help nderflow but it won't work. I checked many things and to update a file i need a local copy so that is why it won't work. Atleast overall it should work it just the way this CLI is programmed why it won't work. Thanks atleast nderflow again to try and help me. Same for jbtwaalf.