Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. Yum install ncftp
  2.  
  3. apt-get install ncftp
  4.  
  5. ncftpput -R -v -u "ftp-username" ftp.website.com ftp-upload-path local-path/*
  6.  
  7. -R
  8.  
  9. find my-dir -exec echo "put /Users/username/"{} {} ;
  10.  
  11. #!/bin/bash
  12.  
  13. hostname="my-ftp-host"
  14. username="username"
  15. password="password"
  16. ftp -in $hostname <<EOF
  17. quote USER $username
  18. quote PASS $password
  19.  
  20. binary
  21. cd 123456
  22. {COPY THE LIST HERE}
  23. quit
  24. EOF
  25.  
  26. //Taking source and target directory path
  27. string sourceDir = FilePath + "Files\" + dsCustomer.Tables[0].Rows[i][2].ToString() + "\ConfigurationFile\" + dsSystems.Tables[0].Rows[j][0].ToString() + "\XmlFile";
  28.  
  29. string targetDir = FilePath + "Files\Customers\" + CustomerName + "\" + SystemName + "\";
  30. foreach (var srcPath in Directory.GetFiles(sourceDir))
  31. {
  32. //Taking file name which is going to copy from the sourcefile
  33. string result = System.IO.Path.GetFileName(srcPath);
  34.  
  35. //If that filename exists in the target path
  36. if (File.Exists(targetDir + result))
  37. {
  38. //Copy file with a different name(appending "Con_" infront of the original filename)
  39. System.IO.File.Copy(srcPath, targetDir + "Con_" + result);
  40. }
  41. //If not existing filename
  42. else
  43. {
  44. //Just copy. Replace bit is false here. So there is no overwiting.
  45. File.Copy(srcPath, srcPath.Replace(sourceDir, targetDir), false);
  46. }
  47. }
  48.  
  49. enter code here`find my-dir -exec echo "put /Users/username/"{} {} > list.txt ;
  50.  
  51. sftp -C -b sftpbatchfile.txt name@server
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement