Snippets: Difference between revisions

From fakedWiki
Jump to: navigation, search
No edit summary
No edit summary
Line 3: Line 3:
find htdocs/ -type d -iwholename "*/*src*/*" -exec mkdir -vp /srv/_tmp/{} \;
find htdocs/ -type d -iwholename "*/*src*/*" -exec mkdir -vp /srv/_tmp/{} \;
find htdocs/ -type f -iwholename '*/*src*/*' -print0 | xargs -0 -I{} mv -fv "{}" "/srv/_tmp/{}"
find htdocs/ -type f -iwholename '*/*src*/*' -print0 | xargs -0 -I{} mv -fv "{}" "/srv/_tmp/{}"
</pre>
Move certain files from a tree with full path
<pre>
find htdocs/ -type f -iname "*.zip" -print0 | xargs -0 -I{} dirname /srv/_tmp/{} | xargs mkdir -pv
find htdocs/ -type f -iname '*.zip' -print0 | xargs -0 -I{} mv -vf "{}" "/srv/_tmp/{}"
</pre>
</pre>

Revision as of 13:47, 12 August 2011

Move certain folders from a tree with full path

find htdocs/ -type d -iwholename "*/*src*/*" -exec mkdir -vp /srv/_tmp/{} \;
find htdocs/ -type f -iwholename '*/*src*/*' -print0 | xargs -0 -I{} mv -fv "{}" "/srv/_tmp/{}"

Move certain files from a tree with full path

find htdocs/ -type f -iname "*.zip" -print0 | xargs -0 -I{} dirname /srv/_tmp/{} | xargs mkdir -pv
find htdocs/ -type f -iname '*.zip' -print0 | xargs -0 -I{} mv -vf "{}" "/srv/_tmp/{}"