cp | greb


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting cp | greb
# 15  
Old 07-08-2012
stat: illegal option -- c
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]

Nope.
# 16  
Old 07-08-2012
OK... so you are running OSX or Debian? I'm confused now.
# 17  
Old 07-08-2012
Would this work?

find . -type f -print0 | xargs -0 stat -c "%y %n" | awk -F"[ :]" $2>=9&&$2<17||$2==17&&$3<=30{print $6}

---------- Post updated at 09:53 AM ---------- Previous update was at 09:51 AM ----------

Quote:
Originally Posted by bartus11
OK... so you are running OSX or Debian? I'm confused now.
O crap... Not debian but darwin.. (sorry its late here)

Darwin Kernel Version 11.4.0
# 18  
Old 07-08-2012
What does this show:
Code:
stat -f "%m %N" /usr/bin/stat

# 19  
Old 07-08-2012
How about this:
Code:
find . -type f -print0 | xargs -0 stat -f "%Sm %N" -t "%H:%M" | awk '/^(09:|1[0123456]:|17:[012]|17:30)/ { print $2 }'

---------- Post updated at 11:30 AM ---------- Previous update was at 10:38 AM ----------

This is driving me nuts!!!
Code:
find . -maxdepth 1 -type f -print0 | xargs -0 stat -f "%Sm %N" -t "%H:%M" | awk '/^(09:|1[0123456]:|17:[012]|17:30)/ { print $2 }' | xargs -I cp /Volumes/Timelapse\ 1/Temp/

returns permission denied...

Help! Smilie

---------- Post updated at 01:23 PM ---------- Previous update was at 11:30 AM ----------

Ok...

So the following code
Code:
find . -maxdepth 1 -type f -print0 | xargs -0 stat -f "%Sm %N" -t "%H:%M" | awk '/^(09:|1[0123456]:|17:[012]|17:30)/ { print $2 }'

works as a selection on screen.

I can also parse it to a txt file but I have absolutely no luck in getting the selection into the copy command... Smilie

Last edited by Franklin52; 07-11-2012 at 05:07 PM.. Reason: Please use code tags for data and code samples, thank you
# 20  
Old 07-08-2012
If this gives you the list of files:
Code:
find . -maxdepth 1 -type f -print0 | xargs -0 stat -f "%Sm %N" -t "%H:%M" | awk '/^(09:|1[0123456]:|17:[012]|17:30)/ { print $2 }'

Then this will copy them to "/somewhere/else"
Code:
find . -maxdepth 1 -type f -print0 | xargs -0 stat -f "%Sm %N" -t "%H:%M" | awk '/^(09:|1[0123456]:|17:[012]|17:30)/ { print $2 }' | xargs -I'{}' cp {} /somewhere/else

This User Gave Thanks to bartus11 For This Post:
# 21  
Old 07-09-2012
Quote:
Originally Posted by bartus11
If this gives you the list of files:
Code:
find . -maxdepth 1 -type f -print0 | xargs -0 stat -f "%Sm %N" -t "%H:%M" | awk '/^(09:|1[0123456]:|17:[012]|17:30)/ { print $2 }'

Then this will copy them to "/somewhere/else"
Code:
find . -maxdepth 1 -type f -print0 | xargs -0 stat -f "%Sm %N" -t "%H:%M" | awk '/^(09:|1[0123456]:|17:[012]|17:30)/ { print $2 }' | xargs -I'{}' cp {} /somewhere/else

Pff so I just forgot a couple of """""'''''"''' '' ' ' '


Damn... but it works now!!

Thank you so much!

---------- Post updated 07-09-12 at 01:28 AM ---------- Previous update was 07-08-12 at 02:35 PM ----------

Quote:
Originally Posted by bartus11
If this gives you the list of files:
Code:
find . -maxdepth 1 -type f -print0 | xargs -0 stat -f "%Sm %N" -t "%H:%M" | awk '/^(09:|1[0123456]:|17:[012]|17:30)/ { print $2 }'

Then this will copy them to "/somewhere/else"
Code:
find . -maxdepth 1 -type f -print0 | xargs -0 stat -f "%Sm %N" -t "%H:%M" | awk '/^(09:|1[0123456]:|17:[012]|17:30)/ { print $2 }' | xargs -I'{}' cp {} /somewhere/else

How come awk '/^(10:|1[0123456]:|15:[012]|15:30)/ give beyond 15:30?? Smilie Any ideas?
Login or Register to Ask a Question

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