The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How can I upload a zip folder on a unix path from my windows folder? ajit.yadav83 Windows & DOS: Issues & Discussions 2 01-29-2009 08:56 AM
Move the file from one folder to another folder sollins Shell Programming and Scripting 1 12-11-2008 04:03 PM
script for Finding files in a folder and copying to another folder satish2712 Shell Programming and Scripting 5 09-11-2008 04:07 PM
Auto copy for files from folder to folder upon instant writing Bashar UNIX for Advanced & Expert Users 2 08-21-2008 02:44 PM
Parse the .txt file for folder name and FTP to the corrsponding folder. MeganP Shell Programming and Scripting 3 07-03-2007 01:54 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-09-2009
adityamahi adityamahi is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 16
operation on a folder level

hi,
need help in writing a script in perl.
requirement :
1. Search for the files in a particular folder
2. search for a string in the file names
3. Delete the file which matches the string.

Ex: if the folder is C:\TEST
and the folder has 5 files like
2009ABCG.txt
2009MNO.txt
5241AAA.txt
1111aaa.txt and
2009PQR.txt

the matching string is "2009", then i want to delete all the files with the names %2009% i.e files 2009ABCG.txt,2009MNO.txt and 2009PQR.txt should be deleted from the folder C:\TEST
  #2 (permalink)  
Old 02-09-2009
pludi's Avatar
pludi pludi is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2008
Location: .at
Posts: 1,839
If you take a look at the help for the unlink function (perldoc -f unlink), you'll notice an example there using wildcards. Possibly the one-liner
Code:
$ perl -e 'unlink <C:\\TEST\\2009*.txt>;'
could do the job.
Or, since you're apparently on Windows, try
Code:
C:\TEST\> del 2009*.txt
  #3 (permalink)  
Old 02-10-2009
adityamahi adityamahi is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 16
thanks a lot ... the first one worked..
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:54 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0