Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
 
Reply to this topicStart new topic
> Mass copied file - Now how to mass delete?
Delebre
post Aug 8 2006, 07:11 PM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 1
Joined: 8-August 06
Member No.: 6,924



I had to use a quick PHP script to copy a file to multiple directories to make another program function properly... and I used this code to do it:

CODE
<pre><?php system("find * -type d|xargs -i cp --verbose file.ext {}/."); ?></pre>COMPLETE!


Now, I don't like it.. I really don't.. I have it in directories I don't want.. it sent it EVERYWHERE. Is there a way for me to write a similar script to go into each directory find the one 'file.ext' and remove it from every folder? Essentially reversing what this last one did?

Thanks..
Go to the top of the page
 
+Quote Post
DS2K3
post Aug 9 2006, 07:39 AM
Post #2


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,284
Joined: 14-November 04
From: Southampton, Hampshire
Member No.: 4,165



Yep - But how good at PHP are you? If you're OK at it then write yourself a recusrive function using opendir/readdir and unlink. You can probably acheive the same result using bash though.

I'll post a PHP script to do it if I have time tonight - I have a few directory-traversing scripts at home.

D


--------------------
Fixed your problem? Let us know!
richard@linuxhelp.net

www.Gathr.co.uk Online Event Management
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 17th October 2017 - 12:59 AM