mdfind "tag:data" > /tmp/data.txt ; zip -r9@ ~/Desktop/data.zip < /tmp/data.txt

make a zip file containing all files with the openmeta tag "data"

finding all files with the metadata tag "data" using the metadata find command mdfind , writing the list to a temporary file, reading the input for the .zip file from this temporary file.

-1
By: vranx
2009-02-24 14:49:50

These Might Interest You

  • At the start of a vi session and *before* saving any changes use ":!cp % %-" to make a backup of the current file being edited. example: vi /data/some/long/path/file :!cp% %- creates /data/some/long/path/file-


    5
    :!cp % %-
    mpb · 2009-03-17 00:34:24 5
  • helpful when you see something like this: zsh: argument list too long: cp


    0
    for file in ./data/message-snapshots/*.jpg; do cp "$file" /data/digitalcandy/ml/images/; done
    ferdous · 2014-06-14 17:26:21 0
  • This command will copy a folder tree (keeping the parent folders) through ssh. It will: - compress the data - stream the compressed data through ssh - decompress the data on the local folder This command will take no additional space on the host machine (no need to create compressed tar files, transfer it and then delete it on the host). There is some situations (like mirroring a remote machine) where you simply cant wait for a huge time taking scp command or cant compress the data to a tarball on the host because of file system space limitation, so this command can do the job quite well. This command performs very well mainly when a lot of data is involved in the process. If you copying a low amount of data, use scp instead (easier to type) Show Sample Output


    12
    ssh <host> 'tar -cz /<folder>/<subfolder>' | tar -xvz
    polaco · 2009-11-10 20:06:47 4
  • Have wc work on each file then add up the total with awk; get a 43% speed increase on RHEL over using "-exec cat|wc -l" and a 67% increase on my Ubuntu laptop (this is with 10MB of data in 767 files).


    -1
    find . -type f -name '*.c' -exec wc -l {} \; | awk '{sum+=$1} END {print sum}'
    arcege · 2009-09-04 15:51:30 3
  • make a bunch of files with the same permissions, owner, group, and content as a template file (handy if you have much to do w. .php, .html files or alike)


    0
    echo "template file: ";read tpl;echo "new file(s separated w. space):"; read fl;touch $fl;find $fl -exec cp -ap $tpl "{}" \;
    knoppix5 · 2013-03-08 10:00:36 2
  • Say you have a directory structure like "foo/, foo/data/, bar/, bar/data/". If you just want to ignore 'bar/data' and you use "ack --ignore-dir=data pattern" it will ignore both foo/data and bar/data and 'ignore-data=bar/data' etc won't work.


    0
    ack -a -G '^(?!.*bar/data.*).*$' pattern
    rkulla · 2010-05-10 00:13:11 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: