fastest way to delete
fastest way to delete
Line 1: Line 1:
= Finding or searching through files and folders =
= Finding or searching through files and folders =


== Search for a string ==
== Search for a string ==
Line 27: Line 28:
$ grep -r -e word /etc"
$ grep -r -e word /etc"
</source>
</source>


= Copy including hidden files =
= Copy including hidden files =
Line 36: Line 38:
</source>
</source>


= Delete files recursively =
 
= Delete files =
 
 
== Delete files recursively ==


* ''Lasted tested on Ubuntu 16.04.2 LTS (xenial)
* ''Lasted tested on Ubuntu 16.04.2 LTS (xenial)
Line 43: Line 49:
$ find . -type f -name "*.mp4" -exec rm {} \;
$ find . -type f -name "*.mp4" -exec rm {} \;
</source>
</source>
== Fastest way to delete a folder ==
* {{testedon|2021-03-09|RHEL 8.3}}
<source lang="console">
$ mkdir empty
$ rsync -a --delete empty/ foldername
</source>


= Setting a default group for a folder =
= Setting a default group for a folder =
* ''Last tested on Ubuntu 16.04 LTS (xenial)''
* ''Last tested on Ubuntu 16.04 LTS (xenial)''


Line 92: Line 110:
$ zip -r test.zip ./test
$ zip -r test.zip ./test
</source>
</source>


= Mirror a folder =
= Mirror a folder =
{{testedon|2020-06-08|CentOS 8}}
{{testedon|2020-06-08|CentOS 8}}


Line 120: Line 140:
$ rsync -azv ~/folder_a/ mhan@tom.myserver.com:~/folder_b/
$ rsync -azv ~/folder_a/ mhan@tom.myserver.com:~/folder_b/
</syntaxhighlight>
</syntaxhighlight>


= Move files older or less than x days =
= Move files older or less than x days =
* ''Last tested on Ubuntu 14.04.5 LTS (trusty)''
* ''Last tested on Ubuntu 14.04.5 LTS (trusty)''