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.


Sign Up Now
Reply to this topicStart new topic
> Mass copied file - Now how to mass delete?
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:

<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?

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

Its GNU/

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.


Fixed your problem? Let us know! Online Event Management
Go to the top of the page
+Quote Post

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


RSS Lo-Fi Version Time is now: 15th July 2018 - 10:17 PM