The UNIX and Linux Forums  

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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Count files in every subdirectory yorryk Shell Programming and Scripting 3 08-12-2008 02:22 PM
[Question]How to copy files to all subdirectory dzufauzan UNIX for Dummies Questions & Answers 2 07-08-2008 10:45 PM
Find files in directory and its subdirectory jyotib Shell Programming and Scripting 11 01-24-2008 01:19 PM
Find files including subdirectory and Delete thepurple Shell Programming and Scripting 1 10-04-2007 03:57 AM
How can I copy files and subdirectory? odogbolu98 UNIX for Dummies Questions & Answers 3 02-15-2002 12:14 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 08-20-2008
Registered User
 

Join Date: Aug 2008
Posts: 3
How to deleting some files under subdirectory

Hi guys, sorry if my english not very well.. i have a problem.. i have a file and the structure is :

Folder/
Folder/10.123.124.20/pm_data/A200807
Folder/10.123.124.20/pm_data/A200807
Folder/10.123.124.20/pm_data/A200807
Folder/10.123.124.20/pm_data/A200808
Folder/10.123.124.20/pm_data/A200808
Folder/10.123.124.20/pm_data/A200808

Folder/10.123.124.21/pm_data/A200807
Folder/10.123.124.21/pm_data/A200807
Folder/10.123.124.21/pm_data/A200808
Folder/10.123.124.21/pm_data/A200808
Folder/10.123.124.21/pm_data/A200808

I just wanna delete A200808, but till now i even can't sorting the file using this command

ls Folder/10*/pm_data/A200808*

but when am type

ls Folder/10*/pm_data/*

it's work.. pls somebody.. help me ...
Reply With Quote
Forum Sponsor
  #2  
Old 08-20-2008
Registered User
 

Join Date: Aug 2008
Posts: 81
For deleting the file that starts with A200808*, u can use the below code

rm -f ls -1 Folder/10*/pm_data/A200808*
Reply With Quote
  #3  
Old 08-20-2008
Registered User
 

Join Date: Aug 2008
Posts: 3
many thx for replying my thread.. I already found the pattern..

find Folder/ -name A200808* -exec rm -f {} \;

am lil bit confuse, i've been trying this command before, but it's not working.. when am try again few hour ago, and they work's... strange...

i use this SunOS machine :

SunOS 5.9 Generic_118558-11 sun4u sparc SUNW,Sun-Fire-V240

btw thx for helping me ....
Reply With Quote
  #4  
Old 08-20-2008
Registered User
 

Join Date: Mar 2008
Posts: 21
You should execute below.

Code:
find Folder/ -name 'A200808*' -exec rm -f {} \;
Because
Before command parameters is used by find command
Your shell expands parameters.

After you execute "touch A200808.txt",
You can figure out difference by below commands.

Code:
echo A200808*
Code:
echo 'A200808*'
Reply With Quote
  #5  
Old 08-20-2008
Registered User
 

Join Date: Aug 2008
Posts: 3
[quote=p50p100;302226935]You should execute below.

Code:
find Folder/ -name 'A200808*' -exec rm -f {} \;
i've been tried using that patternm but it seems doesn't work.. anyway i will check again.. thx for replying bro....
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:45 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0