ls and gzip

Francesco_IT

New Member
Hello I would like to have an advice I'm trying to zip some files that were written on a certain date by doing an ls -l | grep "Aug 1" | xarg doesn't work. You have suggestions Thank you Greetings
 


Rob

Administrator
Staff member
Hey there - generally, you don't want to base the output of a command on hoping ls did its job, but i've done it in the past..

For the ls -l you're going to get a string of different things.. the permissions, the date, the size, name of file, etc.. so while you can grep for "Aug 1", the xarg will be against the whole string, not just the filename..

So, if you wanted to continue down that road, you could use awk, but then you'd need to know if you have to account for spaces in the file names, etc..

What i'd maybe do in this case is use the find command to find things from x days ago, then do stuff to those..

here's some info on find:
 

Members online


Latest posts

Top