Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: XCV – cut, copy and paste files with bash (github.com/busterc)
47 points by busterc on Jan 2, 2015 | hide | past | favorite | 12 comments


Apologies ahead of time for grammar and spelling, I am on a phone.

This is a really cool idea, although you would you be willing to implement it using a file which would cache the cut/copy operations until a paste is done?

As it stands, whether you copy or cut the underlying operation is a cp. This means no matter what you pay the price of creating a copy of each file. There are a couple of ramifications of this, that I can think of at least. One, surprising labeling of files - selinux labels are dependent on how files are created. As such a move does not create new labels, where a copy does. Depending on what the operation is, the user might want to retain or remove the existing label. As it stands, the user cannot do the former. It is also possible that a file cannot be copied/moved to the home directory but to the destination directory only. Two, loss of filesystem move advantage. When you move a file within the same filesystem all that happens is a new link is created in the directory and the old one is deleted. This means the data of the file goes no where. Generally the "copy then delete" method is used between file systems. By doing this manually you cause this process to happen all the time. Worse, it is possible the SRC, HOME, and DST are all different file system, so this would cause three different copies.

However, if you implement a file within the HOME/.xcv directory which contains the source and the method of transfer you can make the transfer a direct source to destination affair.

Overall, I really like this project - could have saved a lot of time with it. Good luck!


I'm glad you like it, in its infancy it's already saved me a good bit of time! Your concerns make sense and I do want to eventually reconsider the paste processing; for now, for me it's sufficient but please do submit a pull request.


It's interesting that this software is using NPM as package manager even if it's written in Shell itself.


The copy/cut/paste paradigm is ubiquitous, but I've always thought that a better model would be mark/duplicate/move.

Where copy+paste is achievable by mark+duplicate and cut+paste by mark+move.

That way you don't have the danger of losing cut content if you forget to paste.


Cool project!

What about a syntax like:

  Copy all files recursively:

    xcv .

  Cut all files recursively:

    xcv -x .

  List all files which will be pasted:

    xcv -l

  Paste all copied files elsewhere:

    xcv -v /elsewhere
It's just that most people will want to do those things by default, and remembering "xcv c -R ." is a bit more mental effort than "xcv ." But maybe that's just a personal preference.


Thanks. You'll notice I listed some aliases: fsx, fsc, fsv, fsl. I'm not yet sure what most others will want, myself included, as defaults so I avoided baking in naive opinions. Fortunately aliases should allow us all to tweak accordingly. I appreciate the feedback and look forward to hearing from others.


The requirement for adding -R might be useful. Consider the case of accidentally executing `xvc .` from within $HOME.

Of course, cp/mv already provide plenty of ways to obliterate your foot so...


First thing I thought too: the options should have a dash.

(yes cool project too)


Something like this would be less likely to accidentally delete files (copy copy paste just purges the list, not the actual files): https://gist.github.com/fjolnir/e24f806e39a3776033d5


I wrote something similar sometime back: https://github.com/ashisha/x-cut-copy-paste

But the ability to list the files being copied is brilliant indeed.


No one knows about xsel anymore?


I don't think you read this properly. This isn't about working with the X clipboard - it's about copying/moving files on the filesystem.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: