Get the list of local files that changed since their last upload in an S3 bucket

changing_assets = `s3cmd sync --dry-run -P -M --exclude=*.php --delete-removed #{preprod_release_dir}/web/ #{s3_bucket} | grep -E 'delete:|upload:' | awk '{print $2}' | sed s_#{preprod_release_dir}/web__`
Can be useful to granulary flush files in a CDN after they've been changed in the S3 bucket.
Sample Output
/css/app_facebook.css
/css/cupertino/jquery-ui-1.7.2.custom.css
/css/fan_css.css
/css/main.css

2
2010-05-07 16:03:42

These Might Interest You

  • The easiest way to sync a local directory to Rackspace cloud files is through the console tools provided by the openstack/swift project. On ubuntu, the tools can be installed with apt-get install python-swiftclient Then, assuming you are in the directory you want to upload, run the following command in the terminal: This will recursively upload the files from your current directory to the container, saving time by uploading only changed files. You need to supply the you use to log in to the Cloud Control Panel and the available under Account / Account Settings in the same control panel. Attention: If you use relative or absolute paths, swift will upload them with the pseudo-path provided on the command line into the container. So if instead of syncing . you sync /var/www/test, then files will end up under /var/www/test pseudo-path of the container - most likely, this is not what you want.


    0
    swift -A https://auth.api.rackspacecloud.com/v1.0 -U <username> -K <api-key> upload <containername> . --changed
    nchatu · 2017-03-03 12:02:57 0

  • 0
    for i in (aws s3api list-buckets --query "Buckets[].Name" | cut -d"," -f1 | grep -vE "\[|\]"); echo $i ; aws s3api get-bucket-policy --bucket (echo $i | xargs); end
    tuannvm · 2017-07-19 15:56:54 0
  • Only shows files with actual changes to text (excluding whitespace). Useful if you've messed up permissions or transferred in files from windows or something like that, so that you can get a list of changed files, and clean up the rest.


    1
    git diff --numstat -w --no-abbrev | perl -a -ne '$F[0] != 0 && $F[1] !=0 && print $F[2] . "\n";'
    lingo · 2009-08-19 05:07:58 2
  • Lists ONLY the files changed by the given HASH/HEAD/list of hashes, etc. The message, commit ID, author, etc. is not included


    2
    git show --relative --pretty=format:'' --name-only HASH
    lingo · 2009-08-14 03:36:03 0

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: