Hi guys,
I am trying to execute a command to clear the contents of all the files under my /home/user/test directory by giving this command
Code:
find /home/user/test -type f -exec cat /dev/null > {} \;
The commands runs without any error, but unfortunately the files are not cleared. Whereas if I give the following command individually for every file,
Code:
debian:~/test#cat /dev/null > <file-name-to-be-cleared>
it works fine. That is the files are cleared. Now since there are many files under the /home/user/test directory, I want to make use of the command find as mentioned above.
Can anyone tell me what command is it? I used examples from the man find command to build the command, but unfortunately I am not able to use it.
thanks