Showing posts with label file. Show all posts
Showing posts with label file. Show all posts

Thursday, 21 February 2013

Find files

$ find /dir/to/search -name "fileName"

$ find   -name "fileName*"
this will search in the current directory and its sub-directories . It turned out that on my RedHat I had to use " " instead of single quotes ' '

$ find /dir/to/search -type d  -name "dirName"
search for a directory with name "dirName"

Monday, 18 February 2013

Download file to a specific location using WGET

WGET is unix command used to download file.
To download a file on specific location:


wget  -P  "C:\Users\me\Desktop"  http://address/of/file.doc

-P prefix
--directory-prefix=prefix
           Set directory prefix to prefix.  The directory prefix is the
           directory where all other files and sub-directories will be
           saved to, i.e. the top of the retrieval tree.  The default
           is . (the current directory).

Friday, 26 October 2012

Put file content into a variable

Linux

filetext=`cat printme`
echo "$filetext"

NOTE: note the ` char.
This will read the file printme and will assign its text to the variable filetext