linux - How to recursively do commands based on if a file exists -
I must check that a file exists in new.htaccess multiple directories (recursive) and Execute:
I think the loop might work but I have a syntax Not sure about (I am a Nob for the loop).
I think it should look like this, but as I said I am a Noah and I am not getting it to do the right thing:
For R-new.htaccess * rm .htaccess rename new.htaccess .htaccess rm .htpasswd} I use Red Hat linux with a Bobby v3.2.25 on Godaddy 4GH Shared Hosting
Thanks for the help!
From the initial directory, run:
find-name "new .htaccess "-exec sh -c 'f =" {} "dir_f = $ (name of the name" $ f ") new_f =" $ dir_f / .htaccess "mv -f" $ f "" $ new_f "rm -f" $ Dir_f / .htpasswd "'\; explanation:
- search
-name "new.htaccess"again all "new.htaccess" files -
f(i.e../ sub / dir / new .htaccess) for each file,dir_f(i.e/ Sub / dir) - Calculate the path of the new file
new_f(i.e../ sub / dir / .htaccess) - Run
fabovenew_f(-fmeans "overwrite if necessary") . - Delete
.htpasswdin the same folder (-fmeans "do not complain if there is any .htpasswd")
Comments
Post a Comment