Moving Files From Google Drive Except Google Drive Files
If you want to move all files from Google Drive except for the ones with specific Google extensions (.gshortcut, .gdoc, .gsheet, .gslides, .gform, .gjam, .gmap, .gsite), you can use the rsync
command with the --exclude
option to specify the file extensions to be excluded. Additionally, you can exclude common system files like “Icon?” and “.DS_Store” to avoid transferring them. Here’s the command to achieve this:
|
|
Explanation of the command:
rsync
: The command for syncing files and directories.-avP
: Options for rsync:-a
: Archive mode, which preserves permissions, ownership, timestamps, and more.-v
: Verbose mode, which displays detailed information about the syncing process.-P
: Progress option, which shows progress during the transfer and allows you to resume interrupted transfers.
--exclude
: This option specifies the patterns for files or directories to be excluded from the sync. You’ve listed all the Google extension file types to be excluded, as well as “Icon?” and “.DS_Store” files.--remove-source-files
: This option removes the transferred files from the source directory after a successful transfer."Google Drive ([email protected])/example/"
: This is the source directory path. Make sure to adjust it to the actual path of your Google Drive../temp
: This is the destination directory where the files will be moved to. You can change this path as needed.
Please replace "Google Drive ([email protected])/example/"
with the actual path to your Google Drive directory, and "./temp"
with the desired destination directory where you want to move the files.
After running this command, all the specified files from your Google Drive (except those with the specified extensions) will be moved to the destination directory, and the source files will be removed.