I am trying to write command which can look for the files which are older than 14 days and tar those files, I have tried many things but what happens is they find result give the names of the file and the tar command just writes the name into one files.
Command used:
find /dir/subdir/ -type f -mtime +14 | tar -cvf data.tar -T -
Please consider the following:
find /dir/subdir/ -type f -mtime +14 > file.list
tar -cvf data.tar -L file.list
You may need to modify the find
call using something like -print0
switch on Linux if your file names contain white space-like symbols.