Toon posts:

[Linux] ssh find & replace op specifieke subfolders

Pagina: 1
Acties:

Acties:
  • 0 Henk 'm!

Verwijderd

Topicstarter
Beste Tweakers,

Momenteel draai ik tientallen WordPress sites op mijn server met dezelfde template. Nu wil ik graag een bestandje (contact.php) van die template via ssh aanpassen. Dit zou kunnen met het find command:

find -name "contact.php" cp /path-naar-nieuw-bestand/contact.php {} \;

Echter, het bestand contact.php komt niet alleen in de map van mijn thema voor, maar ook op andere locaties op de servers die ik niet wil overschrijven.
Ik heb bijvoorbeeld het volgende geprobeerd:

find */mijnthema -name "contact.php" cp /nieuwcontact/contact.php {} \;
find -name "*/mijnthema/contact.php" cp /nieuwcontact/contact.php {} \;

Maar dit commando accepteert geen wildcards op deze plek. Is er een andere manier waarop ik contact.php in de map mijnthema kan vervangen voor elke site op de server?

Alvast bedankt!

Acties:
  • 0 Henk 'm!

  • Herko_ter_Horst
  • Registratie: November 2002
  • Niet online
Volgens mij moet het kunnen met "find -path pattern".

"Any sufficiently advanced technology is indistinguishable from magic."


Acties:
  • 0 Henk 'm!

  • deadinspace
  • Registratie: Juni 2001
  • Laatst online: 20:04

deadinspace

The what goes where now?

Ik zou dit gewoon doen met shell globbing ipv find:
% for FILE in /srv/www/*/mijnthema/contact.php; do ls -l $FILE; done
-rw-r--r-- 1 nobody nobody 4 Sep 1 12:16 /srv/www/example.com/mijnthema/contact.php
-rw-r--r-- 1 nobody nobody 4 Sep 1 12:16 /srv/www/voorbeeld.nl/mijnthema/contact.php
etc

Acties:
  • 0 Henk 'm!

  • NMe
  • Registratie: Februari 2004
  • Laatst online: 09-09 13:58

NMe

Quia Ego Sic Dico.

Ik zou dit in elk geval vragen in Non-Windows Operating Systems, waar de experts rondlopen, en niet in een programmeerforum. Dat staat ook niet voor niets benoemd in Waar hoort mijn topic? ;)

PRG>>NOS

'E's fighting in there!' he stuttered, grabbing the captain's arm.
'All by himself?' said the captain.
'No, with everyone!' shouted Nobby, hopping from one foot to the other.


Acties:
  • 0 Henk 'm!

  • Hero of Time
  • Registratie: Oktober 2004
  • Laatst online: 22:26

Hero of Time

Moderator LNX

There is only one Legend

Is de inhoud van dat contact.php compleet anders, of is er maar een klein gedeelte aangepast, zoals een adres of andere tekst die je moet vervangen of toevoegen?

Commandline FTW | Tweakt met mate


Acties:
  • 0 Henk 'm!

  • CAPSLOCK2000
  • Registratie: Februari 2003
  • Laatst online: 22:42

CAPSLOCK2000

zie teletekst pagina 888

find /var/www/ -name "contact.php" cp /path-naar-nieuw-bestand/contact.php {} \;

en dan in plaats van '/var/www' de hoofdir waar al die wordpress installs staan.

This post is warranted for the full amount you paid me for it.


  • syl765
  • Registratie: Juni 2004
  • Laatst online: 12-09 14:47
@ capslock2000
Dit zal alle contact.php in de hoofd dir vervangen. Er staan ook contact.php files die niet vervangen moeten worden volgens mij als ik de topic start goed lees.

Acties:
  • 0 Henk 'm!

  • CAPSLOCK2000
  • Registratie: Februari 2003
  • Laatst online: 22:42

CAPSLOCK2000

zie teletekst pagina 888

oeps, helemaal gelijk, ik heb niet goed gelezen. Herko_ter_Horst heeft het goede antwoord al gegeven.

This post is warranted for the full amount you paid me for it.

Pagina: 1