Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

For some reason(Happened before I started working on this project)- my client's website has 2 duplicates of every single file. Effectively tripling the size of the site.

The files look much like this:

wp-comments-post.php    |    3,982 bytes
wp-comments-post (john smith's conflicted copy 2012-01-12).php    |    3,982 bytes
wp-comments-post (JohnSmith's conflicted copy 2012-01-14).php    |    3,982 bytes

The hosting that the website is on has no access to bash or SSH.

In your opinion, what would be the easiest way to delete these duplicate files that would take the least time?

share|improve this question
I didn't say this before, but the site has half a gig of files across many directories. I'm looking for a way to search for files with the string "conflicted copy" and delete them. –  Eric Harrison Mar 23 '12 at 16:20
I'm wondering if it might be easier to start with a new, clean WordPress installation. wp-comments-post.php is a standard WP file. What are the other files that are dupes that make this idea unworkable? Alternatively, since you have no shell access, it might be easier to download everything from the hosting company, fix it locally, and push it back up as a new installation. –  cjc Mar 23 '12 at 16:37
Thanks for the help guys, I ended up just downloading the files locally, using windows to search and delete the files, then uploaded it back to the ftp server. –  Eric Harrison Mar 23 '12 at 17:22
Do you know what is the name/version of the remote FTP server's engine? The commands available in that version will dictate the route to take... –  Yanick Girouard Mar 23 '12 at 17:45

4 Answers 4

You can use FSlint to find duplicate files.

share|improve this answer

Run this: find /yourdir -name "*conflicted copy*" -type f -ls

If the files listed are the ones you want to delete, change -ls for -delete and run it again.

I suggest backuping your base dir first with tar before you do this...

EDIT: I just realized you do not have access to a shell session, so this won't work for you...

You would probably need something like this: http://www.go4expert.com/forums/showthread.php?t=2348 to dump a list of files recursively, and then create another script that deletes the ones you want only.

share|improve this answer
You can use -delete instead of -exec rm -f {} \; to avoid the fork() overhead. –  Steve Kemp Mar 23 '12 at 16:38
Good point, I forgot about that switch –  Yanick Girouard Mar 23 '12 at 16:46
This does't help the OP, given that he has no shell access. –  cjc Mar 23 '12 at 17:14
Oops, dang, I missed that completely... Won't be easy then! I don't know of an FTP equivalent for the find command, and he'd need that to dump a whole list of duplicates recursively... Without that, he's out of luck. –  Yanick Girouard Mar 23 '12 at 17:40

Edit: use ftpfs to mount a remote ftp filesystem at a local mountpoint, then use any other approach detailed here.

If all the files conform to that syntax, you could for example

rbos@chili:~/tmp$ touch asdf.php
rbos@chili:~/tmp$ touch "asdf (blah blah blah).php"
rbos@chili:~/tmp$ touch "asdf (blah blah rawr).php"
rbos@chili:~/tmp$ find | grep "(.*)"
./asdf (blah blah rawr).php
./asdf (blah blah blah).php

to match the files, and then just pipe that into xargs or a loop to check the list:

find | grep "(.*)" | while read i; do echo "$i";done | less

and then replace echo with rm once you're satisfied that the list is accurate.

share|improve this answer

FTP into the server and rm the files.

share|improve this answer
Sorry for not providing enough information- but there are too many to delete individually. Is there a way to search for a specific string and delete those files? –  Eric Harrison Mar 23 '12 at 16:22
Too many to do by hand? Let me introduce you to the "intern"... –  Bart Silverstrim Mar 23 '12 at 16:24
Too many to do individually? Seriously? Get a listing, process it into rm commands, then run the commands from your ftp client. What's the hard part? –  MikeyB Mar 26 '12 at 3:58

protected by Community Nov 3 '12 at 8:35

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.