find /usr/local/test5 -type f -mtime +30 -exec ls -l {} \; | awk '{print $5, $6, $7, $8, $9}'
I have this as output:
14 Aug 12 00:00 /usr/local/test5/file1
14 Aug 12 00:00 /usr/local/test5/lastname,
The bolded part is where I run into trouble. The actual filename is:
/usr/local/test5/lastname, firstname.pdf
I want to return the whole file name with spaces and all and delete it at the end of the find command via | and xargs.
Anyone know how to handle issues like this with spaces in the filenames? Keep in mind this is a script that deals with files uploaded by users I have no control over, so spaces in filenames I can't control.
Hey guys thanks for this, I am trying to add another line to delete the output with "rm" , but I am getting errors saying "no such file or directory"
this is obviously due to the spaces in the filename.
Here is an example of what I am running that is throwing errors.