Hatena::Groupperl

perl初心者

2008-12-31

指定したディレクトリの特定の名前のファイルを削除する

15:30

指定したディレクトリの特定の名前のファイルを削除するスクリプトを作ってみました。

削除するファイル名は「***(1).mp3」のようなmp3ファイルで、( )内の数字は1桁の数値が入っています。

#! /bin/perl -w
use strict;

my $dirname = 'C:\Documents and Settings\work';
opendir(DIR, $dirname) or die "$dirname: $!";
while (my $dir = readdir(DIR)) {
	next unless ($dir =~ /\(\d\)\.mp3$/);
	my $filename = $dirname.'\\'.$dir;
	print '削除ファイル ===== ', "$filename\n";
	unlink($filename);
	}
closedir(DIR);

opendirでディレクトリをディレクトリハンドル"DIR"に関連付けて、readdirで読み込みます。

正規表現のパターンマッチでファイルを選別して、削除しています。

  

readdirで読み込むのがディレクトリエントリというのが理解できなくて、unlink($dir);として、動作しなくて少し悩みました。unlink($dir);だとカレントディレクトリの$dirというファイルが削除されるんですね。

my $filename = $dirname.'\\'.$dir;のようにして、きちんとファイルを指定する必要がありました。

  

はてなスターありがとうございます。Uchimataさん。

EnvippinoEnvippino2017/05/27 22:51It will be easier for you if they are going to explain the details about the item you are about to purchase. What can you do?"Benefits of Using Managed HostingBenefits of Using Managed HostingJune 7, 2012 Author: Dhruv Patel Posted in MarketingOnline businesses are easy to manage only when it is small. <a href=http://www.cheapchinanfljerseyswholesale.us.com/>Wholesale NFL Jerseys</a>.<a href=http://www.cheapchinanfljerseyswholesale.us.com/>Wholesale Jerseys From China</a>. Men and women can be in a position to seem stylish with this choice. Good Luck. There are also many other similar products and services offered over in The information you collect will help you know which ones offer ideal costs and payment choices.<a href=http://www.cheapchinanfljerseyswholesale.us.com/>Cheap NFL Jerseys</a>."I would give big money, but not for long years," Hamels said during a May conversation about the frailty of pitchers. You can rest assure on their quality of merchandise and services. With dedicated server, you do not have any loop holes in the internet security. The military will tell you to take the test but will not let you know what the test is about. Rigel continually updates themselves to be sure they can to give their customer the best and most up to date products. There are also others who are very comfortable with it.
Visit my site锟斤拷http://www.cheapchinanfljerseyswholesale.us.com/

EnvippinoEnvippino2017/06/15 01:42Number of View :118Many organizations do have a Human Resource team to assist them with the hiring of brand new staff to help grow and improve the crew. It just makes sense because most clubs have numerous activities which can be dangerous and can involve accidents and mishaps.Ultimately health is something we do to ourselves, <a href=http://www.cheapnfljerseyssportsshop.com/>Cheap Jerseys</a>, not something others do to us.Jamie Carragher, Graeme Souness and Jamie Redknapp have all been critical in their roles for Sky, though, when pressed, Rodgers would only say: “I am talking about people outside of here. Crank out confident that yourself reach your software program very carefully and pin issue the parts, which yourself do not desire. There are many people, that like to buy one of these brilliant items,<a href=http://www.cheapnfljerseyssportsshop.com/>Cheap NFL Jerseys Wholesale</a>, however they do not check with experts plus they do not read about the models on the web. once the height is as thick as the pad of yourforefinger, the height is proper. Otherwise, you could pull a muscle and be out of commission for a while. Some allow multiple links from the resource box; others only allow a couple of. That's when I thought I'd rather say something and hopefully catch this thing before I make the same mistake I made a couple of years ago, when I tried to play through it and made it worse. Your self must be guaranteed that by yourself are seeking into the info that an representative features your self with regards toward the agreement that your self are having into.<a href=http://www.cheapnfljerseyssportsshop.com/>Cheap NFL Jerseys China Wholesale</a>.Most people know the frustration and feeling of helplessness one experiences when one is in a hurry and suddenly forced to a crawling pace or standstill when the road is blocked due to an accident or construction work.
Visit my site:http://www.cheapnfljerseyssportsshop.com/

EnvippinoEnvippino2017/06/17 14:57The user can also have the chance to format the text, italics as well as the colors of such files. Just about all tattoo artists are aware of the great need of a great tattoo machine and every time demands good quality tattoo machines for superb work.You can stay on top of fashion by being unique.When you would be selecting the Bharatanatyam Los Angeles class, there would be many options that would be available. It is not going to be use ledgers that can add to the mess in your office. Accessories for your hair include scrunchies in a myriad of colors and fabrics, headbands, elegant barrettes, and even clip-on hair extensions. <a href=http://www.cheapnfloutletjerseys.us.com/>Cheap Jerseys</a>.Just have things throughout the dwelling that displays them you are the very best. Hit flat and decisively to the point if desired. Most of the breast pumps introduced to the market in the last year or so also have a space on them so that you can actually place your babies picture right in front of you too. Mordred, with a white face and hisarm in a sling, was leaning at the embrasure of one of the windows, looking out.<a href=http://www.cheapnfloutletjerseys.us.com/>Cheap NFL Jerseys</a>.<a href=http://www.cheapnfloutletjerseys.us.com/>Wholesale Jerseys</a>.
Visit my site锟斤拷http://www.cheapnfloutletjerseys.us.com/

EnvippinoEnvippino2017/06/20 15:16org today. When you feel like going casual, grab a ponytail holder and wear your hair back. Starting with your fingertips make slow circular movements towards your nipple finishing off with some larger movements and complete hand movements down the chest. These innocent pets depend on their owners to ensure they lead the best life possible. <a href=http://www.cheapnfljerseyschina-wholesale.us.com/>Wholesale Jerseys Free Shipping</a>.<a href=http://www.cheapnfljerseyschina-wholesale.us.com/>Cheap NFL Jerseys Outlet</a>. These days,<a href=http://www.cheapnfljerseyschina-wholesale.us.com/>Wholesale Nike NFL Jerseys</a>, people can make tattoos with the help of a tattoo kit as well as other products for tattoo artists are available in the marketplace. You can even approach some instructors so that they can give you an advice about the best course that will be right for you.If you're the ideal in grades, use a chart up within the review room. Plug ins and add ons can also be added for your system to work better. Truly people obtain confused regarding which tattoo supplies is the best as well as which tattoo machines kit to start with is easily the most appropriate for all of them. There are special diets designed specifically for aging dogs to guard against joint problems.
Visit my site锟斤拷http://www.cheapnfljerseyschina-wholesale.us.com/

EnvippinoEnvippino2017/06/21 17:47Young has one year and $16 million left on his contract.65 ERA in 31 appearances. It puts them in a better position regarding taking preventative steps.This is an ancient style in dancing for some Indians that may be known up to their moment. Accessories and shoes are also important components of good style. Wear your hair a little messy, <a href=http://www.cheapnfloutletjerseys.us.com/>Wholesale NFL Jerseys</a>, unbutton your shirt, or wear shoes that don’t perfectly match your outfit. Try the relaxation techniques and breathing exerciThings to consider before buying a tattoo kitHarpold Yoshimura   Submitted 2014-01-01 09:02:29 Prior you get a tattoo done you require to think about all the essential elements that could influence your whole curiosity about a selection of the tattoo design.How To Select The Best Bharatanatyam ClassHow To Select The Best Bharatanatyam ClassNovember 16,<a href=http://www.cheapnfloutletjerseys.us.com/>Cheap Jerseys From China</a>, 2013 Author: Alyce Powell Posted in EducationBharatanatyam Los Angeles has been a very popular Indian dance that belongs to the Southern part of the state.<a href=http://www.cheapnfloutletjerseys.us.com/>Wholesale Jerseys From China</a>. Plug ins and add ons can also be added for your system to work better.”“But this is monstrous!” he exploded.
Visit my sitehttp://www.cheapnfloutletjerseys.us.com/

RichardawameRichardawame2017/10/07 06:09These items turn out to be particularly essential for those who go through any tough patches.Be sure to include an easily-completed unsubscribe link in all of your marketing emails. These real estate buildings are occupied by automobile showrooms as well as theme eateries. <a href=http://www.wholesalejerseyscheaper.com/>Wholesale Jerseys Cheap</a>.Power and magnification are both indispensable, and they should be borne in mind before purchasing a rifle.linkedin.When you are intending on travelling in the coming several weeks,<a href=http://www.wholesalejerseyscheaper.com/>Wholesale NFL Jerseys Online</a>, ensure that your vision out for advertising offers on the web by means of various discounted journey internet sites.Search For Free Indiana Criminal Records OnlineSearch For Free Indiana Criminal Records OnlineAugust 25, 2013 | Author: Christopher Evans | Posted in BusinessRecords of arrest in Indiana are opened and can be easily accessed by the local residents of the state. CONTIN?A EN " HOSPITALIZACION DOCMICILIARIA ", INCAPAZ DE VALERSE POR SI MISMA.<a href=http://www.wholesalejerseyscheaper.com/>Wholesale Jerseys Online</a>. Try to click on "Amend" found close to "Tongue" to display the language drop-down menu.com. Usted dice que mi esposa se movi?, de la misma manera en que dijo que en ocho d?as super?a el grave problema que se le caus?. Others, keen to provide their entrepreneurial skills, go crazy about the leadership front.
Visit my site:http://www.wholesalejerseyscheaper.com/

DavidGressDavidGress2017/10/11 18:50Considering the plenty of online shops present today, an individual should be vigilant regarding what store or dealer they is enrolling to. It brings down the quality of your latest news information site and you can get fined by the search engine crawlers because it will be a repetition of content. In fact, <a href=http://www.cheapnfljerseyschinawholesaler.com/>Cheap Authentic NFL Jerseys</a>, the Red Stockings were still practically covered from waist to ankle with knee pants and red socks, which offered better protection than the Sox's skimpy shorts.aitheinhealing. Taking into concerns this truth, buying products online can be of no difficulty. * Keep the top of the battery clean. One could easily try to find their required things in just few seconds.<a href=http://www.cheapnfljerseyschinawholesaler.com/>Cheap Jerseys From China</a>. If this happens, you will require a brand-new car battery replacement to get your vehicle running again.As hydroponic farming is turning out to be more popular, the selling of hydroponic kits has happen to be a thriving business. You consequently do not want those embarrassing moments whenever your friends are existing.<a href=http://www.cheapnfljerseyschinawholesaler.com/>Cheap Vintage Jerseys Sale</a>. You cannot be sure until you get people to come and check the entire premises for the presence of such a chemical. I recommend that you watch the video to gain a better understanding of Lead Generation.
Visit my site:http://www.cheapnfljerseyschinawholesaler.com/

RichardawameRichardawame2017/10/12 14:41Cisco as of late reported that by 2017, 80 percent of all Internet activity will be feature sees. Most lease businesses usually allow about 45, 000 on free usage limits for any duration of three years. Consider the office example discussed earlier: even in two offices with the same hardwood furnishings, both designed for intellectual contemplation, the office with two lamps and reflective finishes on the hardwood will probably seem lighter and larger than an office which relies solely upon a single overhead light for illumination.) Look for a great and trustworthy online store.Someday your midwifery services business might become such a success that you might consider selling it. For example, <a href=http://www.wholesalejerseyscheapnfl.us.com/>Wholesale NFL Jerseys</a>, you can use two different forms of the same sales page and see which one converts more often. But when it comes to PPC, a tip that can prove to be golden for many online marketers is to take it one step at a time.Entertainment optionsHow will you entertain your guests? If the venue has a dance floor, then you can hire a DJ and that pretty much solves the entertainment aspect. You can possibly get a hold of the services workout psychologist and up a scheduled appointment with ease. Here are things you should do to find the right people this time.<a href=http://www.wholesalejerseyscheapnfl.us.com/>Wholesale NFL Jerseys Online</a>. Regardless of the truth which the ideologies directing modern styles are similar even in the dining space furnishings, person requirements is often captured inside the customized sorts of the dining space furniture.<a href=http://www.wholesalejerseyscheapnfl.us.com/>Wholesale NHL Jerseys China</a>. Online networking is additionally a key instrument for making new client associations that can blossom into future business.
Visit my site:http://www.wholesalejerseyscheapnfl.us.com/

RichardawameRichardawame2017/10/21 19:48Photo shooting is one among the mainstay of this town. Enjoy here and get back your lost energy by being closer to the nature!Marketing To Achieve All Of Your Furniture Retail Business GoalsMarketing To Achieve All Of Your Furniture Retail Business GoalsApril 10, 2013 Author: Adam Stossel Posted in Business” Furniture Retail Business as usual” is not expand rate that a custom furniture retail business owner wants, <a href=http://www.wholesalechinajerseysnflcheap.com/>Wholesale Jerseys</a>,<a href=http://www.wholesalechinajerseysnflcheap.com/>Cheap Jerseys Free Shipping</a>, it’s a healthy one. The trendy still and video production los angeles california have all the facilities in the photography world. Photography is the most typical business within the Hollywood city. A wholesale merchant can gain great measure of cash in a short compass of time in the event that he has the self-control to do as such. Most of these products can last up to several years without any repair. Entry into the business you start at a Director level for a cost of $299.<a href=http://www.wholesalechinajerseysnflcheap.com/>Wholesale NFL Jerseys Free Shipping</a>.Have a jingle written by a songwriter. Presentation is additionally very crucial. Use online resourcesWith great online tools such as Angie’s List, you can find and compare handyman services quickly and easily. Make it catchy and irresistible. Seventy five percent of the assignment is done if she is won impartially.
Visit my site??http://www.wholesalechinajerseysnflcheap.com/

grouptuffgrouptuff2017/11/24 10:09It reduces the frequency of bowel movements. Scott Brash, Peter Charles, Ben Maher and Nick Skelton were the winners after a jump-off (the riding equivalent of a penalty shoot out) between Team GB and the Netherlands.So if one is curious as to what the services they offer are, then take a look at this list. This specific meal needs to consist of at the least six-hundred calories and contain protein, choline, nutrients and vitamins. From there the situation soon spirals unable to cope and sees Sinbad along with his brother (and partner in crime) arrested from the city guards and brought before Lord Akbari, who decides the fastest way to avenge his son's death is usually to make Sinbad watch since he executes his buddy. Now do take note that there are so many more services from different firms. At first look, this first analysis shows the new technology provides a more economical running encounter. Wicker storage baskets come in a variety of shapes and sizes.robinsonsequestrian. Your team colors are displayed on it in light weight fabric. <a href=http://www.adidasnmduk.co.uk/>adidas uk</a>.<a href=http://www.adidasnmduk.co.uk/adidas-tubular-c-9.html>adidas originals tubular women</a>.<a href=http://www.adidasnmduk.co.uk/adidas-gazelle-c-4.html>adidas gazelle men</a>. The simple to slightly more complex means to advertise your search engine marketing services company name is all out there. If you truly want to look sexy in your swimwear then you閳ユ獟l want to make sure to consider having a great pair of sandals to enhance your look.
Visit my site锛歨ttp://www.adidasnmduk.co.uk/

EnvippinoEnvippino2017/11/24 11:12How to Advertise Storage Baskets to your Customers 1. All creators and companies should be aware of the scope of their rights before they draw up or agree to a licensing agreement.Although Mr Hernandez remains as one of the share holders with The Berkley Group , <a href=http://www.adidasnmduk.co.uk/>adidas women originals</a>,in 2007 decided to leave The Berkley Group to dedicate himself full time to the development and growth of the Tropicalaser brand. Most studio art classes have recently incorporated computer graphics and software packages into their curricula. Extractum Bryophyllum Calycinum or Hemsagar in this formulation is well known for curing piles, stomachache, constipation and itchiness. Wicker baskets are stylish,<a href=http://www.adidasnmduk.co.uk/adidas-gazelle-c-4.html>green gazelles</a>, unique and are built with high quality workmanship, ensuring longevity and customer satisfaction. Once you find that out, it is easy to start working on the problem. Go to legend leasing when you want to find out more regarding financing a car without having ever dealing with the dealership.A contemporary exampleAmerican companies lose tens of billions of dollars each year due to software piracy.Tropicalaser is positioned as a value leader with the same quality as more expensive competitors.Exactly during which time cheats go inCouple having to do with an individual if any, relish going to be the have to explore have and for redundancies but take heart a lot of times there is that a multi function want both to and from management to learn more about be able to get a multi function complicated is really a great much more than to have as as quickly as possible as doable for more information regarding always make sure that going to be the organisation can excersice on Managers ought to ensure they are educated in the reality it however following going to be the suitable guidelines will take a little longer than do nothing more than handing out and about redundancy notices words the selection process can bring benefits to learn more about going to be the boss about whether or not performed appropriately. Constipation is also common in pregnant women but it goes away after their delivery.<a href=http://www.adidasnmduk.co.uk/adidas-stan-smith-c-7.html>stan smith sale</a>.
Visit my site锛歨ttp://www.adidasnmduk.co.uk/

RichardawameRichardawame2017/11/24 14:12It has the largest democracy in the world, after it obtained its independency in 1947; it made a big progress in all fields of human activity. Mumbai, also originally known as Bombay, it is one of the most famous, bustling, cosmopolitan cities in India. The earliest school of medicine known to humankind was Ayurveda.Lawyers are really helpful when you are involved in a legal matter as they are helpful to get you out of trouble. <a href=http://www.cheapjerseysnflwholesalechina.us.com/>Cheap Wholesale Jerseys</a>.Some time we need agents for dealing when we have to purchase some huge product, but if make deal online we can get a big collection and we can choose any thing which we want some time on shop we get product which we don’t want but in online deal we can know at our home only that product which we want is available or not. The earliest school of medicine known to humankind was Ayurveda..In addition, it is worth to see the smallest state in India, Goa.. It's crucial to you that you have the appropriate information and that is is portrayed in a clear and concise manner. Doing investigation into these plans can enable you save income on health insurance. Es incre?ble la facilidad conque se puede enga?ar a una persona y la forma en que el tiempo se puede " congelar " para que 8 d?as se conviertan en 5 meses, posiblemente en 6, 7,<a href=http://www.cheapjerseysnflwholesalechina.us.com/>Cheap Jerseys From China</a>,<a href=http://www.cheapjerseysnflwholesalechina.us.com/>Cheap Jerseys Wholesale</a>, 8.
Visit my site:http://www.cheapjerseysnflwholesalechina.us.com/

grouptuffgrouptuff2017/12/02 19:52In order to be considered a good SEO services business, it is important to do follow-ups. <a href=http://www.sabocharmsuk.co.uk/thomas-sabo-rings>thomas sabo rings sale</a>. Art history classes will be very helpful as well.<a href=http://www.sabocharmsuk.co.uk/>thomas sabo bracelet uk</a>.On the run by his home town associated with Basra and under a curse for just a killing that led to the death of his much-loved frankly, the streetwise Sinbad finds out himself cast out that will sea.Article From Article Directory DatabaseWatch Sinbad- Episode 5 S-01 Episode-5Recently on Sinbad Season one Episode 4 "Old Man of the Sea", There are surprises in store after Sinbad and the gang board an left behind ship and meet a vintage man who isn't seeing that sweet as he first appears. It will likewise be advantageous to consider premedical courses if you plan to focus on a medical illustrating niche. Apple won the suit and Psystar agreed to pay $2.These more complicated agreements often include recurring or monthly lease payments. This will give you a better idea of how the industry works and help you to be more successful when you do launch your search engine marketing services company. Thus,<a href=http://www.sabocharmsuk.co.uk/>thomas sabo charm bracelets</a>, it is always crucial that you put good attention about this part of your own arm and do appropriate tricep workout. So, if you want to maintain your physique and get in great shape then seek the guidance of an specialist because without it, you will shed your way. Choose the one that fits the image of your company and the expenses you can take. The male had his heart attack about that time.
Visit my site锛歨ttp://www.sabocharmsuk.co.uk/

DavidGressDavidGress2017/12/07 20:49However, the good thing about such furniture lies in their ability of creating wonders to an otherwise dull looking living room. Once the customers install the app, they can stay engaged in all respects.All the assignments that you would like to have help from the online site are handled by tutors who have PhD degrees in the subject and are experts in doing assignments in the particular subjects helping out students from 12th grade to the graduate levels.An increasing number of corporations, like IG Index, have skilled a lift within the proportion of transactions from iPhone or other mobile phone software platforms. A most significant endorsing position with devoted internet hosting applications is moreover which manage panel in direction of employ the service of. Cycles accomplish in accordance with various types of sports such as mountain biking, <a href=http://www.wholesalenfljerseyscheap.com/>Cheap Jerseys Wholesale</a>, Freestyle bicycles, motorcycles, etc. It might imply the close of your manufacturing vocation or the worst omission that your self contain at any time finished. Rising costs regarding Mumbai's real estate gets recurrently manufactured media. When your content is hard to read, people may not read it.Your Age.<a href=http://www.wholesalenfljerseyscheap.com/>Cheap Jerseys Free Shipping</a>.<a href=http://www.wholesalenfljerseyscheap.com/>Wholesale NFL Jerseys China</a>. You should be careful to use easy words and shorter paragraphs to make your article more user friendly.imgur.
Visit my site:http://www.wholesalenfljerseyscheap.com/