![]() |
Need help for writing shell script
I need some help in writing a shell script, it basically need to delete all my older files , the file name structure is like that :
song100000732200506114828.3gp song100000732200506124528.3gp song100000732200506214528.3gp ..................... ..... · song – constant prefix. · 100000732 – 9 digits unique key [per msisdn] · 200506114528 – time stamp [DDMMYYHHMISS format] The unique key is the same for each play list of specific msisdn. The only thing that changes is the timestamp. so i need for each unique key (there are more then one) the news file will remain Can anyone help me? thanks |
Quote:
|
i need it in a shell
|
>> so i need for each unique key (there are more then one) the news file will remain
I don't get what exactly you want to do..May be you could have been more clear !! Well the following script extracts each field (key and date-time) from the file name.. Code:
#!/bin/bash |
Quote:
find /my/directory -name song*3gp -ctime 50 -print| rm -f which would delete everything min 50 days old You can test that it picks the right files with something like: find /my/directory -name song*3gp -ctime 50 -print| ls -l Cheers flim |
| All times are GMT +2. The time now is 18:19. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.