Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #97 fix. Absolute path in transfer #116

Closed

Conversation

StyleT
Copy link

@StyleT StyleT commented Jan 25, 2016

Fix for Issue #97. Now we can use absolute path in transport.transfer

@StyleT
Copy link
Author

StyleT commented Jan 25, 2016

If I want to upload some file for me it's much more obvious to work with absolute paths:

local.transfer([path.join(__dirname, '../somefile.sh'), '/log/somefile.txt'], '~/');

@@ -109,7 +109,7 @@ Shell.prototype.transfer = function(files, remoteDir, options) {
(remote.username ? remote.username + '@' : ''),
remote.host, remoteDir);

var command = util.format('rsync --files-from %s %s --rsh="ssh -p%s%s" ./ %s',
var command = util.format('cat %s | xargs -n 50 -J % rsync %s --rsh="ssh -p%s%s" % %s',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of questions:

  • Why are you limiting this to 50 files?
  • What are the percentage signs doing?
  • Is this working with spaces and special characters in file names?
  • Is this still working properly with relative paths?
  • How does this perform when uploading hundreds of files?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. It's a chunk limit
  2. See xargs doc http://charlesreid1.com/wiki/Xargs#-I_vs._-J
  3. I hope :)
  4. No, currently... But we can do some algorithm that will transform relative path into absolute. Question only one: what folder should be a "base"?
  5. It will generate few rsync commands

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. man xargs: "The current default value for number is 5000"
  2. Please use %% (https://nodejs.org/api/util.html#util_util_format_format)
  3. Can you verify this?
  4. This is a requirement.

I think your changes break the current functionality where I can specify an array of files (in different or same directories) and the whole tree is rebuilt inside the remote's target directory.

@pstadler
Copy link
Owner

Thanks for your PR. Please check my comments.

@pstadler pstadler closed this Oct 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants