Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

Text only

Find directory

find . -type d -name "dir name"
https://snipt.net/embed/4bf1c8134a2ba8424e21dd1b156fac6a/
https://snipt.net/raw/4bf1c8134a2ba8424e21dd1b156fac6a/
4bf1c8134a2ba8424e21dd1b156fac6a
text
Text only
1
2016-12-04T02:35:12
True
False
False
Oct 14, 2015 at 05:13 AM
/api/public/snipt/141676/
find-directory-ea4b954d
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>find . -type d -name &quot;dir name&quot; </span></pre></div> </td></tr></table>
bash, directory, find

Batchfile

fuh.bat

1
2
3
4
5
:: Fix issue where hidden folders can not be unhidden, because of a malware execution.
:: -----------------------------------------------------------------------------------
:: http://mybroadband.co.za/vb/showthread.php/352368-Can-t-quot-UNHIDE-quot-Hidden-files?s=2178d779b3dcb064b2b7b00e30e7c907&p=6535122&viewfull=1#post6535122
@echo off
attrib /S /D *.* -s -r -h
https://snipt.net/embed/c93bb303b469fabd56fbc22934d6c284/
https://snipt.net/raw/c93bb303b469fabd56fbc22934d6c284/
c93bb303b469fabd56fbc22934d6c284
bat
Batchfile
5
2016-12-02T07:24:03
True
False
False
/api/public/snipt/66472/
fuhbat
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="p">:</span><span class="c1">: Fix issue where hidden folders can not be unhidden, because of a malware execution.</span> </span><span id="L-2"><a name="L-2"></a><span class="p">:</span><span class="c1">: -----------------------------------------------------------------------------------</span> </span><span id="L-3"><a name="L-3"></a><span class="p">:</span><span class="c1">: http://mybroadband.co.za/vb/showthread.php/352368-Can-t-quot-UNHIDE-quot-Hidden-files?s=2178d779b3dcb064b2b7b00e30e7c907&amp;p=6535122&amp;viewfull=1#post6535122</span> </span><span id="L-4"><a name="L-4"></a><span class="p">@</span><span class="k">echo</span> off </span><span id="L-5"><a name="L-5"></a>attrib /S /D *.* -s -r -h </span></pre></div> </td></tr></table>
"file system", "flash drive", directory, fix, malware, pendrive

Text only

remove directory from GIT

1
2
3
git rm -r one-of-the-directories
git commit -m "Remove duplicated directory"
git push origin master
https://snipt.net/embed/5c7dedff4d939d924ea1ff04daaafccd/
https://snipt.net/raw/5c7dedff4d939d924ea1ff04daaafccd/
5c7dedff4d939d924ea1ff04daaafccd
text
Text only
3
2016-12-02T07:24:08
True
False
False
May 07, 2013 at 08:55 AM
/api/public/snipt/60850/
remove-directory-from-git
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>git rm -r one-of-the-directories </span><span id="L-2"><a name="L-2"></a>git commit -m &quot;Remove duplicated directory&quot; </span><span id="L-3"><a name="L-3"></a>git push origin master </span></pre></div> </td></tr></table>
directory, folder, git, remove

Text only

.htaccess: Prevent website directory listing 1

Options -Indexes
https://snipt.net/embed/aaf2d87bdaf511f2cc54905f9701ed8d/
https://snipt.net/raw/aaf2d87bdaf511f2cc54905f9701ed8d/
aaf2d87bdaf511f2cc54905f9701ed8d
text
Text only
2
2016-12-02T07:24:09
True
False
False
/api/public/snipt/54285/
htaccess-prevent-website-directory-listing
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>Options -Indexes </span></pre></div> </td></tr></table>
directory, htaccess, listing

Bash

make directory and multiple subdirectories at once

$ mkdir -p somlor.com/{public,private,log,backup}
https://snipt.net/embed/7ad7fadab1f1a41534a1b25198eff333/
https://snipt.net/raw/7ad7fadab1f1a41534a1b25198eff333/
7ad7fadab1f1a41534a1b25198eff333
bash
Bash
1
2016-12-02T07:24:13
True
False
False
Feb 23, 2013 at 07:10 PM
/api/public/snipt/53807/
make-directory-and-multiple-subdirectories-at-once
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>$ mkdir -p somlor.com/<span class="o">{</span>public,private,log,backup<span class="o">}</span> </span></pre></div> </td></tr></table>
directory, folder, mkdir, ubuntu, web, webdev

Bash

Find all files by extension in a directory recursively

find directory/ -name \*.txt -print
https://snipt.net/embed/80b8c205e59dafa2b74aaef8ad089f91/
https://snipt.net/raw/80b8c205e59dafa2b74aaef8ad089f91/
80b8c205e59dafa2b74aaef8ad089f91
bash
Bash
1
2016-12-04T01:53:37
True
False
False
Aug 10, 2012 at 06:59 AM
/api/public/snipt/45493/
find-all-files-by-extension-in-a-directory-recursively
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>find directory/ -name <span class="se">\*</span>.txt -print </span></pre></div> </td></tr></table>
all, bash, directory, extension, files, find, linux, recursive, recursively, sh

Bash

Directory Tree when there is no tree command

find . -type d -print 2>/dev/null|awk '!/\.$/ {for (i=1;i<NF;i++){d=length($i);if ( d < 5  && i != 1 )d=5;printf("%"d"s","|")}print "---"$NF}'  FS='/'
https://snipt.net/embed/713845f82b8679436af451fbd3bc9b39/
https://snipt.net/raw/713845f82b8679436af451fbd3bc9b39/
713845f82b8679436af451fbd3bc9b39
bash
Bash
1
2016-12-02T07:24:21
True
False
False
/api/public/snipt/38758/
directory-tree-when-there-is-no-tree-command
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>find . -type d -print 2&gt;/dev/null<span class="p">|</span>awk <span class="s1">&#39;!/\.$/ {for (i=1;i&lt;NF;i++){d=length($i);if ( d &lt; 5 &amp;&amp; i != 1 )d=5;printf(&quot;%&quot;d&quot;s&quot;,&quot;|&quot;)}print &quot;---&quot;$NF}&#39;</span> <span class="nv">FS</span><span class="o">=</span><span class="s1">&#39;/&#39;</span> </span></pre></div> </td></tr></table>
bash, directory, file, tree

Bash

Find recently modified files in a given directory

1
2
3
# Find recently modified files in a given directory

find / -mtime -1
https://snipt.net/embed/790c662487ce9064207c69849378c9fb/
https://snipt.net/raw/790c662487ce9064207c69849378c9fb/
790c662487ce9064207c69849378c9fb
bash
Bash
3
2016-12-02T07:24:27
True
False
False
/api/public/snipt/38061/
find-recently-modified-files-in-a-given-directory
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># Find recently modified files in a given directory</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>find / -mtime -1 </span></pre></div> </td></tr></table>
bash, directory, find

C#

Get application path

string appPath = Path.GetDirectoryName(Application.ExecutablePath);
https://snipt.net/embed/766922a9fa0ef30543c513bf024d7e80/
https://snipt.net/raw/766922a9fa0ef30543c513bf024d7e80/
766922a9fa0ef30543c513bf024d7e80
csharp
C#
1
2016-12-02T07:24:28
True
False
False
/api/public/snipt/37846/
get-application-path
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="kt">string</span> <span class="n">appPath</span> <span class="p">=</span> <span class="n">Path</span><span class="p">.</span><span class="n">GetDirectoryName</span><span class="p">(</span><span class="n">Application</span><span class="p">.</span><span class="n">ExecutablePath</span><span class="p">);</span> </span></pre></div> </td></tr></table>
"application path", c#, directory

Bash

directory structure

1
2
3
zurb_foundation/app/assets/stylesheets/foundation
zurb_foundation/app/assets/javascripts/foundation
zurb_foundation/app/assets/images/foundation
https://snipt.net/embed/44320db1e19a54f868f2cc09e409b079/
https://snipt.net/raw/44320db1e19a54f868f2cc09e409b079/
44320db1e19a54f868f2cc09e409b079
bash
Bash
3
2016-12-02T07:24:30
True
False
False
/api/public/snipt/31184/
directory-structure
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>zurb_foundation/app/assets/stylesheets/foundation </span><span id="L-2"><a name="L-2"></a>zurb_foundation/app/assets/javascripts/foundation </span><span id="L-3"><a name="L-3"></a>zurb_foundation/app/assets/images/foundation </span></pre></div> </td></tr></table>
directory, foundation, gem, structure
Copyrighted, illegal, or inappropriate content? Email [email protected].