Add files to dropbox with single curl command

I have been thinking of posting this for sometime now. This is very useful, when you are working on a different Linux box and want to upload a file to dropbox.

 

So, before you run this command, you need to create your auth token in Dropbox developer API page. Once that is done, need to change the 2 parameters in command below. Export your Access token and run the below command.

Here is the command:

tar cvzf /tmp/backup.tgz <folder of your choice>
curl -X POST https://content.dropboxapi.com/2/files/upload \
    --header "Authorization: Bearer $OAUTH_ACCESS_TOKEN" \
    --header "Dropbox-API-Arg: {\"path\": \"/<dropbox path>/$(hostname -s)/$NOW.tgz\"}" \
    --header "Content-Type: application/octet-stream" \
    --data-binary @/tmp/backup.tgz

symlinks -delete all invalid soft links in Linux/Fedora

First of all, install symlinks if it is not installed :

sudo yum install symlinks

and here is the description:

Description : The symlinks utility performs maintenance on symbolic links.
: Symlinks checks for symlink problems, including dangling symlinks
: which point to nonexistent files.  Symlinks can also automatically
: convert absolute symlinks to relative symlinks.
:
: Install the symlinks package if you need a program for maintaining
: symlinks on your system.

and the help for the same:

symlinks: scan/change symbolic links – v1.3 – by Mark Lord

Usage:    symlinks [-cdorstv] dirlist

Flags:    -c == change absolute/messy links to relative
-d == delete dangling links
-o == warn about links across file systems
-r == recurse into subdirs
-s == shorten lengthy links (displayed in output only when -c not specified)
-t == show what would be done by -c
-v == verbose (show all symlinks)

So, if you want to delete all the invalid symlinks in the current directory the just execute:

symlinks -d .
symlinks -d -r .
Enhanced by Zemanta