AOA
My files are:
1-090712
1-090713
1-090714
2-090712
2-090713
2-090714
3-090712
3-090713
3-090714
4-090712
4-090713
4-090714
Now i want to delete a 2 days old files means all files of 090712
Files delete script!
read the man page for "find" carefully.
Watch out for the Manners Taliban!
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
-
- Site Admin
- Posts: 5132
- Joined: Fri May 02, 2003 10:24 am
- Location: Karachi
- Contact:
Re: Files delete script!
Dear refra,
Salam,
# find -type f -name "*-09712" -atime +1 -print0 | xargs -0 rm -f
FYI,
Salam,
You can use find for this purpose.refra wrote:My files are:
1-090712
1-090713
1-090714
2-090712
2-090713
2-090714
3-090712
3-090713
3-090714
4-090712
4-090713
4-090714
Now i want to delete a 2 days old files means all files of 090712
# find -type f -name "*-09712" -atime +1 -print0 | xargs -0 rm -f
FYI,
Best Regards.-atime n
File was last accessed n*24 hours ago. When find figures out how many 24-hour periods ago the file was last accessed, any frac-
tional part is ignored, so to match -atime +1, a file has to have been accessed at least two days ago.
Farrukh Ahmed
-
- Subedar
- Posts: 355
- Joined: Sat May 07, 2005 11:54 am
- Location: Lahore
- Contact:
and also better if you google "regex"
Regards
Rana Tanveer
+923224194457
Linux Student
For Affordable Web Development http://www.affordableprogrammers.com
http://www.qualityprogrammers.com
Rana Tanveer
+923224194457
Linux Student
For Affordable Web Development http://www.affordableprogrammers.com
http://www.qualityprogrammers.com