cp | greb


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting cp | greb
# 8  
Old 07-08-2012
What does this show:
Code:
stat -c "%y %n" * | head

# 9  
Old 07-08-2012
Quote:
Originally Posted by bartus11
statis used to read file's modification date and awk is used to filter files that were modified between 9:00 and 17:30. If this code gives you proper results, then you can copy those files using:
Code:
stat -c "%y %n" * | awk -F"[ :]" '$2>=9&&$2<17||$2==17&&$3<=30{print $6}' | xargs -i cp {} /somewhere/else


Okay That makes sense yes Smilie

But shouldn't I define a time for AWKSmilie
# 10  
Old 07-08-2012
This: $2>=9&&$2<17||$2==17&&$3<=30 defines the time in awk...
# 11  
Old 07-08-2012
...


Pauls-Mac-mini:NEED TO DOWNLOAD mmtimelapse$ stat -c "%y %n" * | head
-bash: /usr/bin/stat: Argument list too long

aaaaah

---------- Post updated at 09:40 AM ---------- Previous update was at 09:36 AM ----------

stat -c "%y %n" * | awk -F"[ :]" '$2>=9&&$2<17||$2==17&&$3<=30{print $6}'

Give the same problem.
# 12  
Old 07-08-2012
Try
Code:
find . -type f -exec stat -c "%y %n" {} \; | awk -F"[ :]" '$2>=9&&$2<17||$2==17&&$3<=30{print $6}'

# 13  
Old 07-08-2012
hehe... terminal when to an infinite loop of stat awk
# 14  
Old 07-08-2012
But you see filenames appearing?
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question