Snippets: Difference between revisions
From fakedWiki
No edit summary |
m (4 revisions imported) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 9: | Line 9: | ||
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{} dirname /srv/_tmp/{} | xargs mkdir -pv | ||
find htdocs/ -type f -iname '*.zip' -print0 | xargs -0 -I{} mv -vf "{}" "/srv/_tmp/{}" | find htdocs/ -type f -iname '*.zip' -print0 | xargs -0 -I{} mv -vf "{}" "/srv/_tmp/{}" | ||
</pre> | |||
Replace space with underscore in all files and folders recursively | |||
<pre> | |||
find "/tmp" -name "* *" | while read -r FILE; do mv -v "$FILE" `echo $FILE | tr ' ' '_'`; done | |||
</pre> | </pre> |
Latest revision as of 20:10, 26 August 2016
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/{}"
Replace space with underscore in all files and folders recursively
find "/tmp" -name "* *" | while read -r FILE; do mv -v "$FILE" `echo $FILE | tr ' ' '_'`; done