chokka
asked on
Using Command line code, How to copy a file from one folder to another folder in the Linux Server
I want a batch file which can be executed from .Net Programming for File Copy in the Linux Server. I have done the File Transfer through sftp using third party tool : Chilkat sftp to my Linux server. I can see the file in the \home\<user_id>\ folder. I am not able to find a solution for FileCopy by using Chilkat sftp dll. So i am thinking of implementing a .bat file which can be executed from VB.Net Program for file copy.
Server Name : MyTestServer
Username : TestUser
Password : TestPassword
Filename : Test.csv
Current File Path : \home\<Login_userid>\Test. csv
Expected file path : \home\Folder\SubFolder\Tes t.csv
Server Name : MyTestServer
Username : TestUser
Password : TestPassword
Filename : Test.csv
Current File Path : \home\<Login_userid>\Test.
Expected file path : \home\Folder\SubFolder\Tes
ASKER
@David, Thank you !! I am little confused on your post.
I need two parameters : sourcefile and destinationfile.
Let's say the batch file name as CopyCommand.bat
I should be able to run this batch file as
I need two parameters : sourcefile and destinationfile.
Let's say the batch file name as CopyCommand.bat
I should be able to run this batch file as
CopyCommand.bat "\home\<userid>\file.csv" "home\myfolder\folder\file.csv"
CopyCommand.bat "\home\<userid>\file.csv" "home\myfolder\folder\file.csv"
That's right.. not sure what does this "CopyCommand.bat" has wirtten in it actually. if you are doing it via script use .sh extension instead of .bat
TY/SA
TY/SA
ASKER
@sandy, I am not from Linux background. I just mentioned as an example. .bat is a batch file used in windows.
If you want to help me , plz share the syntax
If you want to help me , plz share the syntax
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Just to slightly correct since you want to copy the command should be cp not mv (move)
The question is confusing because you are mixing things that do not run on Linux.
1) Linux you can configure your FTP server to store files in a particular location based on the credentials used to authenticate.
2) if you want processing run on the Linux side, you can use cron which is the Linux scheduler which will run specified commands scripts and perform tasks.
The question is confusing because you are mixing things that do not run on Linux.
1) Linux you can configure your FTP server to store files in a particular location based on the credentials used to authenticate.
2) if you want processing run on the Linux side, you can use cron which is the Linux scheduler which will run specified commands scripts and perform tasks.
ASKER
Thank you Sandy
#!/bin/bash
mv /path/to/source /path/to/destination