Saturday, November 27, 2010

Find command demystified-2

Find command can be used to copy move or delete files as we need.
>find -name "*.mp3" -exec cp {} /path/to/folder \;
This command will move all your files to a particular /path/to/folder .

Similarly you can move or delete files.
>find -name "*.mp3" -exec cp {} /path/to/USB \;
>find -name '*.mp3' -exec rm {} \;

Find files using the ownership parameter.
>find /path/to/folder -user -name “*.doc” 

Direct the output of find command to a file.
>find / -name "*.mp3" > record.txt
This command will save the paths of all mp3 files in a txt file, record.txt.

No comments:

Post a Comment