Hello,
I was wondering if exist any command that I could use in a script where I want to copy/delete files and directories since a date. I know how to use commands such as
cp and rm but I don't know if there is any command that allows me directly to copy/erase since a time. The idea of this would be have a 1st hard drive where the data comes and leave it there for a time, after that erase all the content and copy it to another hard drive. So the 2nd hard drive has everything on it and the first only have the newest information.
I have done some scripts but nothing complicated. I'm asking here because I haven't found any command I could use for this.
Thanks beforehand,
Antonio
Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
copying/deleting directory and files since a time
Re: copying/deleting directory and files since a time
like rsync? or like a snap shot?
http://www.admin-magazine.com/Articles/ ... or-Backups
Or perhaps snapshots on, say, btrfs?
http://www.admin-magazine.com/Articles/ ... or-Backups
Or perhaps snapshots on, say, btrfs?
- dilberts_left_nut
- Administrator
- Posts: 5346
- Joined: 2009-10-05 07:54
- Location: enzed
- Has thanked: 13 times
- Been thanked: 66 times
Re: copying/deleting directory and files since a time
Use 'find' to, well, find what you want and the '-exec' parameter to do something to it.
Code: Select all
man find
AdrianTM wrote:There's no hacker in my grandma...
- kiyop
- Posts: 3983
- Joined: 2011-05-05 15:16
- Location: Where persons without desire to improve themselves fear to tread, in Japan
- Been thanked: 3 times
Re: copying/deleting directory and files since a time
+1dilberts_left_nut wrote:Use 'find' to, well, find what you want and the '-exec' parameter to do something to it.
Code: Select all
man find
Be careful for files the name of which contain special characters such as space " ' \ ( ) { }
"-print0 | xargs -0" is useful sometimes.
Openbox, JWM: Jessie, Sid, Arch / Win XP (on VirtualBox), 10
http://kiyoandkei.bbs.fc2.com/
http://kiyoandkei.bbs.fc2.com/
Re: copying/deleting directory and files since a time
Re: find
Also take caution with the parameters to -mtime, the plus and minus may be counterintuitive.
Also take caution with the parameters to -mtime, the plus and minus may be counterintuitive.