Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A program to solve a problem: filter Linux/Unix 'ls' output
#2
Hi @TDarcos

Clever program.

Did you know you can actually use find command in linux and either pass the results to xargs or use the -exec method to do something ?

Find all files modified since the the last year (run from root directory of where you are scanning):

Code: (Select All)
find . -mtime +365 -print
You could then simply do: 
Code: (Select All)
find . -mtime +365 -exec cp {} destination/dir/{} \;
For every file created or modified since this year (365 days) execute the command:
Code: (Select All)
cp (foundfile) destination/dir/(foundfile)
The funky syntax for the -exec arg simply replaces {} with the found file, and the \; let's you terminate the -exec command. The backslash is to escape the ; in the shell.

Your program is cool too, not saying to not use it. Also it's lots of fun to solve our own problems!

I just wanted to share this 1 liner since i've used it so much in my life. The linux find command is a life saver.

Check out the docs:
Code: (Select All)
man find
grymmjack (gj!)
GitHubYouTube | Soundcloud | 16colo.rs
Reply


Messages In This Thread
RE: A program to solve a problem: filter Linux/Unix 'ls' output - by grymmjack - 07-15-2023, 12:29 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Mystery Mania an 80's Logic Problem Generator justsomeguy 4 1,137 02-09-2025, 08:18 PM
Last Post: justsomeguy
Star MazeBall & DAV & Danilin Solve of Labyrinth DANILIN 1 840 10-12-2024, 11:57 AM
Last Post: DANILIN
  start.command problem on macOS tothebin 3 1,151 04-29-2024, 01:16 AM
Last Post: NakedApe
Lightbulb Linux only: random dark modes for KDE mnrvovrfc 0 575 05-09-2023, 11:10 PM
Last Post: mnrvovrfc
  GUI Shutdown or Restart (Linux) Keybone 4 1,307 04-19-2023, 09:10 PM
Last Post: Keybone

Forum Jump:


Users browsing this thread: 1 Guest(s)