Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

> go ./... magic custom (that means this and all recursive subdirectories).

There. I did just learn it without following a tutorial or somethin. It's so simple, easy to remember. It's even faster to write that -R or -r.



sort by: page size:

This reminds me how much I hate the go ./... magic custom (that means this and all recursive subdirectories).

We have the unix -r custom already. Now we have another, that makes no sense, that you just have to learn.


So basically instead of doing

    dir C:\
I have to learn to type

   List-Directory-With-Files Drive=C Folder=/
(made up example, but you get the point)

Thanks for putting this together. Most of the commands are new to me.

exa -DT

produces a directories-only tree structure. Very helpful.


Oh wow, nice.

Just what I needed to make a directory tree example for a readme.txt


You almost never need to use "*". Use ".", or go up a dir and type the name of the dir.

Using the .. to traverse up the directory tree during a move operation is simply beautiful!

That doesn't recurse into subdirectories.

Well I make all my directories in C:/ or / just because the paths are shorter to type. That's one reason.

Yeah, and it's the simplest way to go to hidden directories.

One of my favorite custom bash function is to use up() function to abstract away all the cd ../../../ command.

Up 3 will put me 3 directories behind the current one.


Os.listdir isn't much harder to remember, and of course os.walk is actually probably easier for recursive filesystem actions.

I like this concept. My solution has been to use '..' '...' and '....' to go up 1,2,and 3 directories.

This is something I wish I implemented as a hobby project but never found the time to do it. Congrats! I see you implement a directory as a file containing a b-tree. Could you provide more info on this?

rupa/z

Being able to type something like "z ab g f" to reach a fairly deeply nested directory is almost akin to magic. I absolutely hate cd'ing everywhere, and often I'm cd'ing between the same couple of directories for a number of projects, so I feel like it helps retain my sanity. I've also written scripts to take advantage of it, such as a cp clone that doesn't require an immediate target. So I can cp a file (or number of files, or a directory), z-jump to a different directory and paste it there instead of laboriously typing out all the directory paths. I love it.


What do you mean by "unix -r custom"? It's not like "-r" is some kind of standard, and many commands or programs have other ideas.

For example, GNU cp uses -r or -R for recursive copy, but OpenBSD cp only uses -R. ls uses -R only (-r is listing in reverse order). scp uses -r only (-R is remote copy). rm allows both -r and -R.

But then, commands like mv or find don't support anything like -r or -R, they implicitly affect the whole directory structure. Bash has * (with shopt -s globstar) for globbing with subdirectories. Make doesn't support any concept of recursive subdirectory traversal.


Reminds me of how they left recursions out of the 'cp' command on plan9, so the recommended way to copy directories is:

@{cd fromdir && tar cp .} | @{cd todir && tar xT}


And you use 'dir' in the command line.

Thanks! I didn't realize you could pass in a non-existent directory, that makes it an easier trick.

I've been looking for something like <() for a long time. Thanks for sharing it!

Regarding :h, is it any different than just using dirname?

next

Legal | privacy