On Thursday 17 February 2011 15:42:52 Stuart Bird wrote:
> Hi All
>
> I have inadvertently copied some files and directories into a system folder
> on a test server (apache). There is a lot of files and folders and I don't
> want to spend the time doing it manually if I can help it. The only way I
> can tell what to delete and what I want to keep is by sorting on the
> creation date aftr running:
>
> # ls -l | grep <creation_time>
>
> What I cant work out is how I can then "rm -R" just those files and
> folders, leaving the ones with the older creation times intact.
>
> Can anybody suggest a command that might work.
'find' is the command you want, with the -mtime option.
Something like:
find /path/to/dir -mtime 2
That should list all files/dirs modified in the last two days.
You can then add the -delete option (although I'm not sure that works on
directories) or use -exec to call rm :
find /path/to/dir -mtime 2 -exec rm -rf {} \;
Cheers
Dave P
--
David Precious <[email protected]> (bigpresh)
http://www.preshweb.co.uk/
"Programming is like sex. One mistake and you have to support
it for the rest of your life". (Michael Sinz)
_______________________________________________
Peterboro mailing list
[email protected]
https://mailman.lug.org.uk/mailman/listinfo/peterboro